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
This commit is contained in:
parent
364efeccb0
commit
ff5e109e47
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90496
@ -43,6 +43,7 @@ static const char rcsid[] =
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ffs/fs.h>
|
#include <ufs/ffs/fs.h>
|
||||||
@ -314,6 +315,7 @@ flushtape()
|
|||||||
void
|
void
|
||||||
trewind()
|
trewind()
|
||||||
{
|
{
|
||||||
|
struct stat sb;
|
||||||
int f;
|
int f;
|
||||||
int got;
|
int got;
|
||||||
|
|
||||||
@ -358,6 +360,10 @@ trewind()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (fstat(tapefd, &sb) == 0 && S_ISFIFO(sb.st_mode)) {
|
||||||
|
(void)close(tapefd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
(void) close(tapefd);
|
(void) close(tapefd);
|
||||||
while ((f = open(tape, 0)) < 0)
|
while ((f = open(tape, 0)) < 0)
|
||||||
sleep (10);
|
sleep (10);
|
||||||
|
Loading…
Reference in New Issue
Block a user