Skip to content

Commit

Permalink
file-method: Don't pass invalid flags to chmod
Browse files Browse the repository at this point in the history
Remove the MATE-VFS masks which aren't valid bits.

Commit message written by Colin Walters <walters@verbum.org>

https://bugzilla.gnome.org/show_bug.cgi?id=542026
  • Loading branch information
jasperla authored and benpicco committed Mar 16, 2012
1 parent f151c08 commit 637a98c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/file-method.c
Expand Up @@ -2378,7 +2378,18 @@ do_set_file_info (MateVFSMethod *method,
}

if (mask & MATE_VFS_SET_FILE_INFO_PERMISSIONS) {
if (chmod (full_name, info->permissions) != 0) {
int tmask;
int permissions = info->permissions;
/*
* ktrace showed "invalid argument", and this makes sense....
* because, we cannot pass the MATE_VFS_PERM_ACCESS_*
* constants to chmod.
*/
tmask = MATE_VFS_PERM_ACCESS_READABLE;
tmask |= MATE_VFS_PERM_ACCESS_WRITABLE;
tmask |= MATE_VFS_PERM_ACCESS_EXECUTABLE;
permissions = permissions & ~tmask;
if (chmod (full_name, permissions) != 0) {
g_free (full_name);
return mate_vfs_result_from_errno ();
}
Expand Down

0 comments on commit 637a98c

Please sign in to comment.