Blame SOURCES/gnome-vfs-2.24.5-file-method-chmod-flags.patch

fc2bfa
From 0bf9ac622fa41978fced2606450d2f906c8ca6f8 Mon Sep 17 00:00:00 2001
fc2bfa
From: Jasper Lievisse Adriaanse <jasper@humppa.nl>
fc2bfa
Date: Thu, 19 May 2011 16:14:54 +0000
fc2bfa
Subject: file-method: Don't pass invalid flags to chmod
fc2bfa
fc2bfa
Remove the GNOME-VFS masks which aren't valid bits.
fc2bfa
fc2bfa
Commit message written by Colin Walters <walters@verbum.org>
fc2bfa
fc2bfa
https://bugzilla.gnome.org/show_bug.cgi?id=542026
fc2bfa
---
fc2bfa
diff --git a/modules/file-method.c b/modules/file-method.c
fc2bfa
index 37e4853..1d70d19 100644
fc2bfa
--- a/modules/file-method.c
fc2bfa
+++ b/modules/file-method.c
fc2bfa
@@ -2378,7 +2378,18 @@ do_set_file_info (GnomeVFSMethod *method,
fc2bfa
 	}
fc2bfa
 
fc2bfa
 	if (mask & GNOME_VFS_SET_FILE_INFO_PERMISSIONS) {
fc2bfa
-		if (chmod (full_name, info->permissions) != 0) {
fc2bfa
+		int tmask;
fc2bfa
+		int permissions = info->permissions;
fc2bfa
+		/*
fc2bfa
+		 * ktrace showed "invalid argument", and this makes sense....
fc2bfa
+		 * because, we cannot pass the GNOME_VFS_PERM_ACCESS_*
fc2bfa
+		 * constants to chmod.
fc2bfa
+		 */
fc2bfa
+		tmask = GNOME_VFS_PERM_ACCESS_READABLE;
fc2bfa
+		tmask |= GNOME_VFS_PERM_ACCESS_WRITABLE;
fc2bfa
+		tmask |= GNOME_VFS_PERM_ACCESS_EXECUTABLE;
fc2bfa
+		permissions = permissions & ~tmask;
fc2bfa
+		if (chmod (full_name, permissions) != 0) {
fc2bfa
 			g_free (full_name);
fc2bfa
 			return gnome_vfs_result_from_errno ();
fc2bfa
 		}
fc2bfa
--
fc2bfa
cgit v0.9.0.2