gnome-vfs-2.24.5-file-method-chmod-flags.patch 1.2 KB

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