aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-04-26 10:53:01 -0700
committerRob Landley <rob@landley.net>2019-04-26 19:51:04 -0500
commit2794b23fb331a1f69807d04defa2c2c21d02c588 (patch)
tree00902d296ff56b0a4d00da3e8c9b068715fb0e29
parent02e370b5db828bb445dc0bfe398f2342d010a7ee (diff)
downloadtoybox-2794b23fb331a1f69807d04defa2c2c21d02c588.tar.gz
gzip: fix permissions perservation despite umask.
-rw-r--r--toys/lsb/gzip.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/toys/lsb/gzip.c b/toys/lsb/gzip.c
index df5bf3af..0fa9b7e1 100644
--- a/toys/lsb/gzip.c
+++ b/toys/lsb/gzip.c
@@ -143,6 +143,7 @@ static void do_gzip(int ifd, char *in)
struct timespec times[] = {sb.st_atim, sb.st_mtim};
if (utimensat(AT_FDCWD, out, times, 0)) perror_exit("utimensat");
+ if (chmod(out, sb.st_mode)) perror_exit("chmod");
close(ofd);
if (!FLAG(k) && in && unlink(in)) perror_msg("unlink %s", in);
free(out);