From ed64d01ab5c3c9046e58dcd8303be988c48828bd Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 4 Nov 2023 08:56:19 -0500 Subject: [PATCH] Recognize .tgz->.tar. --- toys/lsb/gzip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toys/lsb/gzip.c b/toys/lsb/gzip.c index e884dbaf..691f9b75 100644 --- a/toys/lsb/gzip.c +++ b/toys/lsb/gzip.c @@ -134,8 +134,9 @@ 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(in, ".gz"))>in) out = xstrndup(in, out-in); + else if ((out = strend(in, ".tgz"))>in) + out = xmprintf("%.*s.tar", (int)(out-in), 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); if (ofd == -1) return; } -- 2.39.2