changeset 774:2adc6b8b3197

2006-7-19 Brian Masney <masneyb@gftp.org> * src/uicommon/gftpui.c - make sure the directories have the proper permissions when "preserve file permissions" is enabled (from Aurelien Jarno <aurelien@aurel32.net>) (closes #312722)
author masneyb
date Thu, 20 Jul 2006 02:20:49 +0000
parents 942dd9c2a064
children c1144630c4f4
files ChangeLog src/uicommon/gftpui.c
diffstat 2 files changed, 18 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jul 20 02:16:30 2006 +0000
+++ b/ChangeLog	Thu Jul 20 02:20:49 2006 +0000
@@ -1,4 +1,8 @@
 2006-7-19 Brian Masney <masneyb@gftp.org>
+	* src/uicommon/gftpui.c - make sure the directories have the proper
+	permissions when "preserve file permissions" is enabled
+	(from Aurelien Jarno <aurelien@aurel32.net>) (closes #312722)
+
 	* src/gtk/gftp-gtk.c - fixed the default protocol dropdown when some
 	protocols are disabled (from Aurelien Jarno <aurelien@aurel32.net>)
 	(closes #312724)
@@ -3432,7 +3436,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.445 2006/07/20 02:16:29 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.446 2006/07/20 02:20:48 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/src/uicommon/gftpui.c	Thu Jul 20 02:16:30 2006 +0000
+++ b/src/uicommon/gftpui.c	Thu Jul 20 02:20:49 2006 +0000
@@ -1295,6 +1295,11 @@
   gettimeofday (&tdata->starttime, NULL);
   memcpy (&tdata->lasttime, &tdata->starttime, sizeof (tdata->lasttime));
 
+  gftp_lookup_request_option (tdata->fromreq, "preserve_permissions",
+                              &preserve_permissions);
+  gftp_lookup_request_option (tdata->fromreq, "preserve_time",
+                              &preserve_time);
+
   while (tdata->curfle != NULL)
     {
       num_read = -1;
@@ -1333,6 +1338,14 @@
                   tdata->toreq->mkdir (tdata->toreq, curfle->destfile);
                   if (!GFTP_IS_CONNECTED (tdata->toreq))
                     break;
+
+		  if (preserve_permissions && curfle->st_mode != 0)
+                    gftp_chmod (tdata->toreq, curfle->destfile,
+                                curfle->st_mode & (S_IRWXU | S_IRWXG | S_IRWXO));
+
+                  if (preserve_time && curfle->datetime != 0)
+                    gftp_set_file_time (tdata->toreq, curfle->destfile,
+                                curfle->datetime);
                 }
 
               if (g_thread_supported ())
@@ -1476,11 +1489,6 @@
             }
         }
 
-      gftp_lookup_request_option (tdata->fromreq, "preserve_permissions",
-                                  &preserve_permissions);
-      gftp_lookup_request_option (tdata->fromreq, "preserve_time",
-                                  &preserve_time);
-
       if (!curfle->is_fd)
         {
           if (preserve_permissions && curfle->st_mode != 0)