aboutsummaryrefslogtreecommitdiff
path: root/toys/lsb
diff options
context:
space:
mode:
Diffstat (limited to 'toys/lsb')
-rw-r--r--toys/lsb/gzip.c4
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);