]> git.wh0rd.org - dump.git/blobdiff - restore/tape.c
Correction of block estimate.
[dump.git] / restore / tape.c
index d4a46ed78512f21c349ed99cde2d9ec464635bc8..63eae65ef23cf95a29dd747bed9f3e0a08496bd2 100644 (file)
@@ -46,7 +46,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.29 2001/03/20 10:02:48 stelian Exp $";
+       "$Id: tape.c,v 1.31 2001/03/27 08:09:21 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -1237,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));
                }
@@ -1742,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;