PR/58223: RVP: Don't write to stdout when testing.

This commit is contained in:
christos 2024-05-04 13:17:03 +00:00
parent 8a0c0d837a
commit f57e938466
2 changed files with 6 additions and 5 deletions

View File

@ -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;

View File

@ -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 prelen, off_t *bytes_in)
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;