Browse code

Set permission on copied file based on umask.

Jason Dalton authored on 2013/03/08 14:13:10
Showing 1 changed files
... ...
@@ -812,6 +812,15 @@ def cmd_sync_remote2local(args):
812 812
                     dst_stream.close()
813 813
                     # download completed, rename the file to destination
814 814
                     os.rename(chkptfname, dst_file)
815
+
816
+                    # set permissions on destination file
817
+                    original_umask = os.umask(0);
818
+                    os.umask(original_umask);
819
+                    mode = 0777 - original_umask;
820
+                    debug(u"mode=%s" % oct(mode))
821
+                    
822
+                    os.chmod(dst_file, mode);
823
+                    
815 824
                     debug(u"renamed chkptfname=%s to dst_file=%s" % (unicodise(chkptfname), unicodise(dst_file)))
816 825
                     if response['headers'].has_key('x-amz-meta-s3cmd-attrs') and cfg.preserve_attrs:
817 826
                         attrs = parse_attrs_header(response['headers']['x-amz-meta-s3cmd-attrs'])