Module Name: src
Committed By: christos
Date: Sat May 4 13:17:03 UTC 2024
Modified Files:
src/usr.bin/gzip: unlz.c unxz.c
Log Message:
PR/58223: RVP: Don't write to stdout when testing.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/gzip/unlz.c src/usr.bin/gzip/unxz.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/gzip/unlz.c
diff -u src/usr.bin/gzip/unlz.c:1.8 src/usr.bin/gzip/unlz.c:1.9
--- src/usr.bin/gzip/unlz.c:1.8 Sat Jun 10 00:45:25 2023
+++ src/usr.bin/gzip/unlz.c Sat May 4 09:17:03 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: unlz.c,v 1.8 2023/06/10 04:45:25 simonb Exp $ */
+/* $NetBSD: unlz.c,v 1.9 2024/05/04 13:17:03 christos Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -295,7 +295,7 @@ lz_flush(struct lz_decoder *lz)
size_t size = (size_t)offs;
lz_crc_update(&lz->crc, lz->obuf + lz->spos, size);
- if (fwrite(lz->obuf + lz->spos, 1, size, lz->fout) != size)
+ if (!tflag && fwrite(lz->obuf + lz->spos, 1, size, lz->fout) != size)
return -1;
lz->wrapped = lz->pos >= lz->dict_size;
Index: src/usr.bin/gzip/unxz.c
diff -u src/usr.bin/gzip/unxz.c:1.8 src/usr.bin/gzip/unxz.c:1.9
--- src/usr.bin/gzip/unxz.c:1.8 Sat Oct 6 12:36:45 2018
+++ src/usr.bin/gzip/unxz.c Sat May 4 09:17:03 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: unxz.c,v 1.8 2018/10/06 16:36:45 martin Exp $ */
+/* $NetBSD: unxz.c,v 1.9 2024/05/04 13:17:03 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: unxz.c,v 1.8 2018/10/06 16:36:45 martin Exp $");
+__RCSID("$NetBSD: unxz.c,v 1.9 2024/05/04 13:17:03 christos Exp $");
#include <stdarg.h>
#include <errno.h>
@@ -99,7 +99,8 @@ unxz(int i, int o, char *pre, size_t pre
if (strm.avail_out == 0 || ret != LZMA_OK) {
const size_t write_size = sizeof(obuf) - strm.avail_out;
- if (write(o, obuf, write_size) != (ssize_t)write_size)
+ if (!tflag &&
+ write(o, obuf, write_size) != (ssize_t)write_size)
maybe_err("write failed");
strm.next_out = obuf;