summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2024-05-10 20:28:32 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2024-05-10 20:28:32 +0000
commit46572e5bddb3c4d2c8a02d47cc4314056b92491b (patch)
tree205c81b12dd8f2fef8f982ce1aabe48f3b1be208 /bin
parent656401910f1448a7ad0b3b983de82af5b970c99b (diff)
pax: make list file handle line-buffered unless it is stderr.
This fixes a problem where the file list output was fully-buffered when used as part of a pipeline. With this change, files are listed as they are extracted in verbose mode. OK deraadt@ guenther@
Diffstat (limited to 'bin')
-rw-r--r--bin/pax/options.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/bin/pax/options.c b/bin/pax/options.c
index 2e9960168fd..cd3f5f6285c 100644
--- a/bin/pax/options.c
+++ b/bin/pax/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.114 2024/04/17 18:12:12 jca Exp $ */
+/* $OpenBSD: options.c,v 1.115 2024/05/10 20:28:31 millert Exp $ */
/* $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $ */
/*-
@@ -277,21 +277,20 @@ options(int argc, char **argv)
if (strcmp(NM_TAR, argv0) == 0) {
op_mode = OP_TAR;
tar_options(argc, argv);
- return;
- }
#ifndef NOCPIO
- else if (strcmp(NM_CPIO, argv0) == 0) {
+ } else if (strcmp(NM_CPIO, argv0) == 0) {
op_mode = OP_CPIO;
cpio_options(argc, argv);
- return;
- }
#endif /* !NOCPIO */
- /*
- * assume pax as the default
- */
- argv0 = NM_PAX;
- op_mode = OP_PAX;
- pax_options(argc, argv);
+ } else {
+ argv0 = NM_PAX;
+ op_mode = OP_PAX;
+ pax_options(argc, argv);
+ }
+
+ /* Line-buffer the file list output as needed. */
+ if (listf != stderr)
+ setvbuf(listf, NULL, _IOLBF, 0);
}
/*