X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=restore%2Ftape.c;h=63eae65ef23cf95a29dd747bed9f3e0a08496bd2;hb=60d46c352087c38c29a690d80b62441028579f35;hp=27a98d32bfabe9de89aba4a3d512f8f2c49898ca;hpb=2b7475327b6a1a580f76eca13a18f68a2943a5b1;p=dump.git diff --git a/restore/tape.c b/restore/tape.c index 27a98d3..63eae65 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -46,10 +46,18 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.26 2001/03/18 15:35:44 stelian Exp $"; + "$Id: tape.c,v 1.31 2001/03/27 08:09:21 stelian Exp $"; #endif /* not lint */ #include +#include +#include +#include +#include +#include +#include +#include + #include #include #include @@ -59,28 +67,17 @@ static const char rcsid[] = #include #include #include +#include #include #else /* __linux__ */ #include #endif /* __linux__ */ #include -#include -#include -#include -#include -#include -#include -#include - #ifdef HAVE_ZLIB #include #endif /* HAVE_ZLIB */ -#ifdef __linux__ -#include -#endif - #include "restore.h" #include "extern.h" #include "pathnames.h" @@ -491,15 +488,9 @@ gethdr: goto again; } if (tmpbuf.c_date != dumpdate || tmpbuf.c_ddate != dumptime) { -#ifdef __linux__ fprintf(stderr, "Wrong dump date\n\tgot: %s", ctime4(&tmpbuf.c_date)); - fprintf(stderr, "\twanted: %s", ctime4(&dumpdate)); -#else - fprintf(stderr, "Wrong dump date\n\tgot: %s", - ctime(&tmpbuf.c_date)); fprintf(stderr, "\twanted: %s", ctime(&dumpdate)); -#endif volno = 0; haderror = 1; goto again; @@ -599,15 +590,9 @@ setdumpnum(void) void printdumpinfo(void) { -#ifdef __linux__ fprintf(stdout, "Dump date: %s", ctime4(&spcl.c_date)); fprintf(stdout, "Dumped from: %s", (spcl.c_ddate == 0) ? "the epoch\n" : ctime4(&spcl.c_ddate)); -#else - fprintf(stdout, "Dump date: %s", ctime(&spcl.c_date)); - fprintf(stdout, "Dumped from: %s", - (spcl.c_ddate == 0) ? "the epoch\n" : ctime(&spcl.c_ddate)); -#endif if (spcl.c_host[0] == '\0') return; fprintf(stdout, "Level %d dump of %s on %s:%s\n", @@ -1252,7 +1237,7 @@ comparefile(char *name) panic("cannot delete tmp file %s: %s\n", tmpfile, strerror(errno)); } - if ((ofile = creat(tmpfile, 0600)) < 0) { + if ((ofile = open(tmpfile, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0) { panic("cannot create file temp file %s: %s\n", name, strerror(errno)); } @@ -1757,8 +1742,8 @@ findtapeblksize(void) else { /* read in the rest of the block based on bufsize */ len = bufsize - TP_BSIZE; - if (read_a_block(mt, tapebuf+TP_BSIZE, len, &i) <= 0 - || i != len) + if (read_a_block(mt, tapebuf+TP_BSIZE, len, &i) < 0 + || (i != len && i % TP_BSIZE != 0)) errx(1,"Error reading dump file header"); tbufptr = tapebuf; numtrec = ntrec; @@ -1996,7 +1981,7 @@ good: static void accthdr(struct s_spcl *header) { - static ino_t previno = 0x7fffffff; + static dump_ino_t previno = 0x7fffffff; static int prevtype; static long predict; long blks, i;