[gvfs] smb: Set always G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE for files



commit 2c6f2ff9201b11c49f198b5856e2913a9e21175d
Author: Ondrej Holy <oholy redhat com>
Date:   Mon Jun 13 15:34:31 2016 +0200

    smb: Set always G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE for files
    
    G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE is set for regular files only when
    S_IWUSR is not set currently (i.e. FALSE only). It seems to me that
    it is reliable to set this to TRUE for regular files in other cases.
    Applications should not rely on those attributes, however it is crucial
    for some apps which rely on them still (e.g. File Roller).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724497

 daemon/gvfsbackendsmb.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index 79c944c..6e4bc41 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -1645,8 +1645,8 @@ set_info_from_stat (GVfsBackendSmb *backend,
   /* If file is dos-readonly, libsmbclient doesn't set S_IWUSR, we use this to
      trigger ACCESS_WRITE = FALSE. Only set for regular files, see
      https://bugzilla.gnome.org/show_bug.cgi?id=598206   */
-  if (!(statbuf->st_mode & S_IWUSR) && S_ISREG (statbuf->st_mode))
-    g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FALSE);
+  if (S_ISREG (statbuf->st_mode))
+    g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, statbuf->st_mode & S_IWUSR);
 
   g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]