aboutsummaryrefslogtreecommitdiff
path: root/sbin/dump/tape.c
diff options
context:
space:
mode:
authorIan Dowse <iedowse@FreeBSD.org>2002-02-11 00:50:50 +0000
committerIan Dowse <iedowse@FreeBSD.org>2002-02-11 00:50:50 +0000
commitff5e109e47f889567cadf09aa16fb18831f5169d (patch)
tree5b4dcc66e2de5f096c527a8c657af96381e7d66f /sbin/dump/tape.c
parent364efeccb09ea6e0426acca4fe71906ece1cd8e5 (diff)
downloadsrc-ff5e109e47f889567cadf09aa16fb18831f5169d.tar.gz
src-ff5e109e47f889567cadf09aa16fb18831f5169d.zip
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
Notes
Notes: svn path=/head/; revision=90496
Diffstat (limited to 'sbin/dump/tape.c')
-rw-r--r--sbin/dump/tape.c6
1 files changed, 6 insertions, 0 deletions
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 <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);