Permalink
Browse files

Set permission on copied file based on umask.

  • Loading branch information...
Jason Dalton
Jason Dalton committed Mar 8, 2013
1 parent 3f311f9 commit ad36c4818c8aeec108f9490c802c8a50538ef7a0
Showing with 9 additions and 0 deletions.
  1. +9 −0 s3cmd
View
9 s3cmd
@@ -812,6 +812,15 @@ def cmd_sync_remote2local(args):
dst_stream.close()
# download completed, rename the file to destination
os.rename(chkptfname, dst_file)
+
+ # set permissions on destination file
+ original_umask = os.umask(0);
+ os.umask(original_umask);
+ mode = 0777 - original_umask;
+ debug(u"mode=%s" % oct(mode))
+
+ os.chmod(dst_file, mode);
+
debug(u"renamed chkptfname=%s to dst_file=%s" % (unicodise(chkptfname), unicodise(dst_file)))
if response['headers'].has_key('x-amz-meta-s3cmd-attrs') and cfg.preserve_attrs:
attrs = parse_attrs_header(response['headers']['x-amz-meta-s3cmd-attrs'])

0 comments on commit ad36c48

Please sign in to comment.