[gnome-commander/gcmd-1-2-8] Fixed problem with mkdir permissions



commit c3aa8f7a0b9df451ff527b14bb0f3385bfe61039
Author: Torsten Luettgert <ml-gcmd enda eu>
Date:   Wed Jun 15 19:26:43 2011 +0200

    Fixed problem with mkdir permissions

 NEWS                          |    1 +
 doc/C/gnome-commander.xml     |    3 +++
 src/gnome-cmd-data.cc         |    3 +++
 src/gnome-cmd-data.h          |    2 ++
 src/gnome-cmd-mkdir-dialog.cc |    7 +++----
 5 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 9b850b5..2e24a8a 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Bug fixes:
  * Fixed problem #618214 (crash when cancel a search)
  * Fixed problem #640387 (yet another fix for deprecated python modules: md5, sha1)
  * Fixed problem #649375 (bookmarks not updated for newly added ones)
+ * Fixed problem with mkdir permissions
 
 
 ===================================
diff --git a/doc/C/gnome-commander.xml b/doc/C/gnome-commander.xml
index 8970dcc..ff40df8 100644
--- a/doc/C/gnome-commander.xml
+++ b/doc/C/gnome-commander.xml
@@ -6097,6 +6097,9 @@
                         <listitem>
                             <para>Fixed problem #649375 (bookmarks not updated for newly added ones)</para>
                         </listitem>
+                        <listitem>
+                            <para>Fixed problem with mkdir permissions</para>
+                        </listitem>
                     </itemizedlist>
                 </para>
             </entry>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 849d993..6635bea 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1099,6 +1099,9 @@ GnomeCmdData::GnomeCmdData()
     editor = NULL;
     differ = NULL;
     term = NULL;
+
+    umask = ::umask(0);
+    ::umask(umask);
 }
 
 
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 8837902..8d32ab8 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -204,6 +204,8 @@ struct GnomeCmdData
     gint                         main_win_height;
     GdkWindowState               main_win_state;
 
+    mode_t                       umask;
+
     GnomeCmdData();
 
     void free();                // FIXME: free() -> ~GnomeCmdData()
diff --git a/src/gnome-cmd-mkdir-dialog.cc b/src/gnome-cmd-mkdir-dialog.cc
index 1f90a29..53a7d42 100644
--- a/src/gnome-cmd-mkdir-dialog.cc
+++ b/src/gnome-cmd-mkdir-dialog.cc
@@ -105,13 +105,12 @@ static gboolean on_ok (GnomeCmdStringDialog *string_dialog, const gchar **values
 
     GnomeVFSResult result = GNOME_VFS_OK;
 
+    guint perm = (GNOME_VFS_PERM_USER_ALL | GNOME_VFS_PERM_GROUP_ALL | GNOME_VFS_PERM_OTHER_ALL) & ~gnome_cmd_data.umask | GNOME_VFS_PERM_USER_WRITE | GNOME_VFS_PERM_USER_EXEC;
+
     for (GSList *i = uri_list; i; i = g_slist_next (i))
     {
         GnomeVFSURI *mkdir_uri = (GnomeVFSURI *) i->data;
-        result = gnome_vfs_make_directory_for_uri (mkdir_uri,
-                                                   GNOME_VFS_PERM_USER_READ|GNOME_VFS_PERM_USER_WRITE|GNOME_VFS_PERM_USER_EXEC|
-                                                   GNOME_VFS_PERM_GROUP_READ|GNOME_VFS_PERM_GROUP_EXEC|
-                                                   GNOME_VFS_PERM_OTHER_READ|GNOME_VFS_PERM_OTHER_EXEC);
+        result = gnome_vfs_make_directory_for_uri (mkdir_uri, perm);
 
         // focus the created directory (if possible)
         if (result==GNOME_VFS_OK)



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