From ff5e109e47f889567cadf09aa16fb18831f5169d Mon Sep 17 00:00:00 2001 From: Ian Dowse Date: Mon, 11 Feb 2002 00:50:50 +0000 Subject: [PATCH] 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 MFC after: 1 week --- sbin/dump/tape.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sbin/dump/tape.c b/sbin/dump/tape.c index 807239a5fe07..10b05c9f30e6 100644 --- a/sbin/dump/tape.c +++ b/sbin/dump/tape.c @@ -43,6 +43,7 @@ static const char rcsid[] = #include #include #include +#include #include #include @@ -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);