[gnome-commander] Fixed problem with mkdir permissions



commit 7c5627092f8c0086345effecabfe0da71a7460f6
Author: Torsten Luettgert <ml-gcmd enda eu>
Date:   Wed Jun 15 19:55:28 2011 +0200

    Fixed problem with mkdir permissions

 NEWS                                  |    1 +
 doc/C/gnome-commander.xml             |    3 +++
 src/dialogs/gnome-cmd-mkdir-dialog.cc |    8 +++-----
 src/gnome-cmd-data.cc                 |    3 +++
 src/gnome-cmd-data.h                  |    2 ++
 5 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index 390a4d2..7ad8b36 100644
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,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 d091ad2..91eea19 100644
--- a/doc/C/gnome-commander.xml
+++ b/doc/C/gnome-commander.xml
@@ -7686,6 +7686,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/dialogs/gnome-cmd-mkdir-dialog.cc b/src/dialogs/gnome-cmd-mkdir-dialog.cc
index dda6508..e47cd54 100644
--- a/src/dialogs/gnome-cmd-mkdir-dialog.cc
+++ b/src/dialogs/gnome-cmd-mkdir-dialog.cc
@@ -101,15 +101,13 @@ static void response_callback (GtkDialog *dialog, int response_id, GnomeCmdDir *
 
                     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);
 
                         if (result!=GNOME_VFS_OK)
                         {
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 7b962b7..54aeec0 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -943,6 +943,9 @@ GnomeCmdData::GnomeCmdData(): search_defaults(selections)
     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 efcf278..41fda31 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -262,6 +262,8 @@ struct GnomeCmdData
 
     std::map<guint,std::vector<Tab> > tabs;
 
+    mode_t                       umask;
+
     GnomeCmdData();
 
     void free();                // FIXME: free() -> ~GnomeCmdData()



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