diff options
author | Elliott Hughes <enh@google.com> | 2019-04-26 10:46:11 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-04-26 15:18:42 -0500 |
commit | 663bf3c0c7e9590c183ed00c68964d28cadad8a7 (patch) | |
tree | ecc4e43ea27445f43c744705150214d471bffa44 | |
parent | bd6e9d030cbf709d40fb480449de200d49449dc8 (diff) | |
download | toybox-663bf3c0c7e9590c183ed00c68964d28cadad8a7.tar.gz |
gzip: fix regressions caused by 7964e1f78b58d9c365361cc36b0422d9d56cd204.
The permissions preservation test still fails for me, but that seems to
be because my environment changed: it's failing because of my umask.
I'll fix that in a separate patch, since it's unrelated.
-rw-r--r-- | toys/lsb/gzip.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/toys/lsb/gzip.c b/toys/lsb/gzip.c index 82e76698..df5bf3af 100644 --- a/toys/lsb/gzip.c +++ b/toys/lsb/gzip.c @@ -130,7 +130,7 @@ static void do_gzip(int ifd, char *in) // Add or remove .gz suffix as necessary if (!FLAG(d)) out = xmprintf("%s%s", in, ".gz"); - else if ((out = strend(out, ".gz"))>in) out = xstrndup(out, out-in); + else if ((out = strend(in, ".gz"))>in) out = xstrndup(in, out-in); else return error_msg("no .gz: %s", in); ofd = xcreate(out, O_CREAT|O_WRONLY|WARN_ONLY|(O_EXCL*!FLAG(f)),sb.st_mode); @@ -142,7 +142,7 @@ static void do_gzip(int ifd, char *in) if (out) { struct timespec times[] = {sb.st_atim, sb.st_mtim}; - if (futimens(ofd, times)) perror_exit("utimensat"); + if (utimensat(AT_FDCWD, out, times, 0)) perror_exit("utimensat"); close(ofd); if (!FLAG(k) && in && unlink(in)) perror_msg("unlink %s", in); free(out); |