X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=blobdiff_plain;f=dump%2Ftape.c;h=6f61210c6da4f0957b31d7c6286a7f408d044fbf;hp=a9e3c52bc2cab2e47d9b7b189137f16f5def2703;hb=e1abc9ce25132eef1239047a071c2c1d4822dd9f;hpb=7fcd6df59144f29299a35d54bec24a147fd19f12 diff --git a/dump/tape.c b/dump/tape.c index a9e3c52..6f61210 100644 --- a/dump/tape.c +++ b/dump/tape.c @@ -18,11 +18,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -41,7 +37,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.72 2003/01/10 10:52:48 stelian Exp $"; + "$Id: tape.c,v 1.74 2003/03/30 15:40:37 stelian Exp $"; #endif /* not lint */ #include @@ -110,7 +106,6 @@ extern int ntrec; /* blocking factor on tape */ extern int cartridge; char *nexttape; extern pid_t rshpid; -int eot_code = 1; long long tapea_bytes = 0; /* bytes_written at start of current volume */ static int magtapeout; /* output is really a tape */ @@ -237,14 +232,14 @@ writerec(const void *dp, int isspcl) *(union u_spcl *)(*(nextblock)) = *(union u_spcl *)dp; /* Need to write it to the archive file */ - if (Afile < 0 && isspcl && (spcl.c_type == TS_END)) - Afile = -Afile; - if (Afile > 0) { + if (! AfileActive && isspcl && (spcl.c_type == TS_END)) + AfileActive = 1; + if (AfileActive && Afile >= 0) { /* When we dump an inode which is not a directory, * it means we ended the archive contents */ if (isspcl && (spcl.c_type == TS_INODE) && ((spcl.c_dinode.di_mode & S_IFMT) != IFDIR)) - Afile = -Afile; + AfileActive = 0; else { union u_spcl tmp; tmp = *(union u_spcl *)dp; @@ -560,15 +555,6 @@ trewind(void) (void) close(f); } } - eot_code = 1; - if (eot_script && spcl.c_type != TS_END) { - msg("Launching %s\n", eot_script); - eot_code = system_command(eot_script, tape, tapeno); - } - if (eot_code != 0 && eot_code != 1) { - msg("Dump aborted by the end of tape script\n"); - dumpabort(0); - } } return do_stats(); } @@ -577,8 +563,19 @@ trewind(void) void close_rewind(void) { + int eot_code = 1; (void)trewind(); - if (nexttape || Mflag || (eot_code == 0) ) + if (nexttape || Mflag) + return; + if (eot_script) { + msg("Launching %s\n", eot_script); + eot_code = system_command(eot_script, tape, tapeno); + } + if (eot_code != 0 && eot_code != 1) { + msg("Dump aborted by the end of tape script\n"); + dumpabort(0); + } + if (eot_code == 0) return; if (!nogripe) { msg("Change Volumes: Mount volume #%d\n", tapeno+1);