diff options
author | iedowse <iedowse@FreeBSD.org> | 2002-02-11 00:50:50 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2002-02-11 00:50:50 +0000 |
commit | 0dea933ddd3c0cb3b936bc1ae8dcf9a0b5442a34 (patch) | |
tree | 5b4dcc66e2de5f096c527a8c657af96381e7d66f /sbin/dump/tape.c | |
parent | 336de67dc798bf96317abe10b90898e1dde2db55 (diff) | |
download | FreeBSD-src-0dea933ddd3c0cb3b936bc1ae8dcf9a0b5442a34.zip FreeBSD-src-0dea933ddd3c0cb3b936bc1ae8dcf9a0b5442a34.tar.gz |
Make dump's behaviour more sensible when the output file is a fifo.
Normally trewind() performs a close-open-close cycle to rewind the
tape when closing the device, but this is not ideal for fifos. We
now skip the final open-close if the output descriptor is a fifo.
PR: bin/25474
Submitted by: Alex Bakhtin <bakhtin@amt.ru>
MFC after: 1 week
Diffstat (limited to 'sbin/dump/tape.c')
-rw-r--r-- | sbin/dump/tape.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sbin/dump/tape.c b/sbin/dump/tape.c index 807239a..10b05c9 100644 --- a/sbin/dump/tape.c +++ b/sbin/dump/tape.c @@ -43,6 +43,7 @@ static const char rcsid[] = #include <sys/socket.h> #include <sys/time.h> #include <sys/wait.h> +#include <sys/stat.h> #include <ufs/ufs/dinode.h> #include <ufs/ffs/fs.h> @@ -314,6 +315,7 @@ flushtape() void trewind() { + struct stat sb; int f; int got; @@ -358,6 +360,10 @@ trewind() return; } #endif + if (fstat(tapefd, &sb) == 0 && S_ISFIFO(sb.st_mode)) { + (void)close(tapefd); + return; + } (void) close(tapefd); while ((f = open(tape, 0)) < 0) sleep (10); |