diff options
author | Tom Jones <thj@FreeBSD.org> | 2022-01-27 17:17:13 +0000 |
---|---|---|
committer | Tom Jones <thj@FreeBSD.org> | 2022-01-27 17:20:23 +0000 |
commit | 21c966a6b9f2e9110b8dc2a822ad2b4583f4f18b (patch) | |
tree | 501fec2032f0568b1faa6feeb83206fb04002aac | |
parent | f0ec0fda01c3ecd435201813ebbc929eeccf10a5 (diff) | |
download | src-21c966a6b9f2e9110b8dc2a822ad2b4583f4f18b.tar.gz src-21c966a6b9f2e9110b8dc2a822ad2b4583f4f18b.zip |
Fix test output when gzip is run with -tlv
When run with test, verbose and list we need to parse the file otherwise
the test output is "NOT OK" even for the file is valid.
Reviewed by: kevans, allanjude, imp
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34046
-rw-r--r-- | usr.bin/gzip/gzip.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c index 5128e7ed43e0..f31f744b93f6 100644 --- a/usr.bin/gzip/gzip.c +++ b/usr.bin/gzip/gzip.c @@ -1655,10 +1655,13 @@ file_uncompress(char *file, char *outfile, size_t outsize) case FT_XZ: if (lflag) { size = unxz_len(fd); - print_list_out(in_size, size, file); - return -1; - } - size = unxz(fd, zfd, NULL, 0, NULL); + if (!tflag) { + print_list_out(in_size, size, file); + close(fd); + return -1; + } + } else + size = unxz(fd, zfd, NULL, 0, NULL); break; #endif @@ -1683,8 +1686,10 @@ file_uncompress(char *file, char *outfile, size_t outsize) default: if (lflag) { print_list(fd, in_size, outfile, isb.st_mtime); - close(fd); - return -1; /* XXX */ + if (!tflag) { + close(fd); + return -1; /* XXX */ + } } size = gz_uncompress(fd, zfd, NULL, 0, NULL, file); |