X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=dump%2Fmain.c;h=5953f3941f2a866f6eabff7100e4b17cf2845dcb;hb=c534413c6ada5778ccbb76f36bdcff672037d0cc;hp=0c896738608f9e8b318db313cd31a7a6262f84ab;hpb=871ede100ce41d967ebbb4e2d67c6b7587e16f76;p=dump.git diff --git a/dump/main.c b/dump/main.c index 0c89673..5953f39 100644 --- a/dump/main.c +++ b/dump/main.c @@ -41,10 +41,11 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.47 2001/04/27 12:23:23 stelian Exp $"; + "$Id: main.c,v 1.51 2001/07/18 09:50:48 stelian Exp $"; #endif /* not lint */ #include +#include #include #include #include @@ -57,10 +58,14 @@ static const char rcsid[] = #include #include +#include #ifdef __linux__ +#ifdef HAVE_EXT2FS_EXT2_FS_H +#include +#else #include +#endif #include -#include #include #include #elif defined sunos @@ -124,7 +129,7 @@ main(int argc, char *argv[]) register int ch; int i, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1; dump_ino_t maxino; - struct stat statbuf; + struct STAT statbuf; dev_t filedev = 0; #ifdef __linux__ errcode_t retval; @@ -348,7 +353,7 @@ main(int argc, char *argv[]) tapeprefix = "standard output"; } - if (blocksperfile) + if (blocksperfile && !compressed) blocksperfile = blocksperfile / ntrec * ntrec; /* round down */ else if (!unlimited) { /* @@ -514,6 +519,11 @@ main(int argc, char *argv[]) strncpy(tape, tapeprefix, MAXPATHLEN); tape[MAXPATHLEN - 1] = '\0'; + if (!pipeout) { + if (STAT(tape, &statbuf) != -1) + fifoout= statbuf.st_mode & S_IFIFO; + } + if (!sizest) { msg("Date of this level %c dump: %s", level, @@ -543,7 +553,7 @@ main(int argc, char *argv[]) msg("The ENTIRE dump is aborted.\n"); exit(X_STARTUP); } - if ((diskfd = open(disk, O_RDONLY)) < 0) { + if ((diskfd = OPEN(disk, O_RDONLY)) < 0) { msg("Cannot open %s\n", disk); msg("The ENTIRE dump is aborted.\n"); exit(X_STARTUP); @@ -604,7 +614,7 @@ main(int argc, char *argv[]) nonodump = spcl.c_level < honorlevel; - if (!sizeest) { + if (!sizest) { msg("Label: %s\n", spcl.c_label); if (compressed) @@ -622,7 +632,7 @@ main(int argc, char *argv[]) if (directory[0] == 0) anydirskipped = mapfiles(maxino, &tapesize); else { - if (stat(pathname, &statbuf) == -1) { + if (STAT(pathname, &statbuf) == -1) { msg("File cannot be accessed (%s).\n", pathname); msg("The ENTIRE dump is aborted.\n"); exit(X_STARTUP); @@ -639,7 +649,7 @@ main(int argc, char *argv[]) int anydirskipped2; char *p = *argv; /* check if file is available */ - if (stat(p, &statbuf) == -1) { + if (STAT(p, &statbuf) == -1) { msg("File cannot be accessed (%s).\n", p); msg("The ENTIRE dump is aborted.\n"); exit(X_STARTUP); @@ -815,7 +825,7 @@ main(int argc, char *argv[]) tnow = trewind(); - if (pipeout) + if (pipeout || fifoout) msg("%ld tape blocks (%.2fMB)\n", spcl.c_tapea, ((double)spcl.c_tapea * TP_BSIZE / 1048576)); else @@ -918,7 +928,7 @@ sig(int signo) case SIGHUP: case SIGTERM: case SIGTRAP: - if (pipeout) + if (pipeout || fifoout) quit("Signal on pipe: cannot recover\n"); msg("Rewriting attempted as response to unknown signal: %d.\n", signo); (void)fflush(stderr);