[Toybox] [PATCH] gzip: fix regressions caused by 7964e1f78b58d9c365361cc36b0422d9d56cd204.
enh
enh at google.com
Fri Apr 26 10:49:17 PDT 2019
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.
---
toys/lsb/gzip.c | 4 ++--
1 file 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);
--
2.21.0.593.g511ec345e18-goog
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gzip-fix-regressions-caused-by-7964e1f78b58d9c365361.patch
Type: text/x-patch
Size: 1473 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20190426/637a08d1/attachment-0002.bin>
More information about the Toybox
mailing list