]> git.wh0rd.org - dump.git/blobdiff - dump/tape.c
Added the appropriate error message when dump fails to open the output file.
[dump.git] / dump / tape.c
index 125b15884074869ed1d7b4b4adcf0c58bfcf18f0..e81a58d149d47a8fb3391f0bd999900ead915797 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.63 2002/02/21 09:25:31 stelian Exp $";
+       "$Id: tape.c,v 1.66 2002/03/27 16:48:38 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -71,9 +71,6 @@ int    write(), read();
 #include <sys/wait.h>
 #include <sys/mtio.h>
 #ifdef __linux__
-#include <linux/fs.h>
-#undef atomic_read     /* this get wrongly defined in kernel */
-                       /* headers and we don't want it */
 #ifdef HAVE_EXT2FS_EXT2_FS_H
 #include <ext2fs/ext2_fs.h>
 #else
@@ -875,7 +872,8 @@ restore_check_point:
                                  OPEN(tape, O_RDWR|O_CREAT, 0666))) < 0)
 #endif
                    {
-                       msg("Cannot open output \"%s\".\n", tape);
+                       msg("Cannot open output \"%s\": %s\n", tape, 
+                           strerror(errno));
                        if (!query("Do you want to retry the open?"))
                                dumpabort(0);
                }
@@ -1234,6 +1232,7 @@ doslave(int cmd, int slave_number, int first)
 #ifdef USE_QFA
                if (gTapeposfd >= 0) {
                        int i;
+                       int firstpass = 1;
                        for (i = 0; i < ntrec; ++i) {
                                uspclptr = (union u_spcl *)&slp->tblock[i];
                                spclptr = &uspclptr->s_spcl;
@@ -1243,10 +1242,13 @@ doslave(int cmd, int slave_number, int first)
                                    (spclptr->c_date == gThisDumpDate)) {
                                        /* if an error occured previously don't
                                         * try again */
-                                       if (gtperr == 0) {
-                                               if ((gtperr = GetTapePos(&curtapepos)) == 0)
-                                                       MkTapeString(spclptr, curtapepos);
+                                       if (firstpass) {
+                                               firstpass = 0;
+                                               if (gtperr == 0) 
+                                                       gtperr = GetTapePos(&curtapepos);
                                        }
+                                       if (gtperr == 0)
+                                                       MkTapeString(spclptr, curtapepos);
                                }
                        }
                }