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

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