]> git.wh0rd.org - dump.git/blobdiff - dump/tape.c
Waitpid problem with external RSH.
[dump.git] / dump / tape.c
index b48665ef0e274e4732598a4bc9df8160b298ab1c..1b28c41e6e6307a9a9f662d36fc243c0b28045c3 100644 (file)
@@ -2,8 +2,7 @@
  *     Ported to Linux's Second Extended File System as part of the
  *     dump and restore backup suit
  *     Remy Card <card@Linux.EU.Org>, 1994-1997
- *      Stelian Pop <pop@cybercable.fr>, 1999 
- *
+ *     Stelian Pop <pop@cybercable.fr>, 1999 
  */
 
 /*-
  */
 
 #ifndef lint
-#if 0
-static char sccsid[] = "@(#)tape.c     8.4 (Berkeley) 5/1/95";
-#endif
 static const char rcsid[] =
-       "$Id: tape.c,v 1.3 1999/10/11 12:59:19 stelian Exp $";
+       "$Id: tape.c,v 1.7 1999/11/02 09:35:56 tiniou Exp $";
 #endif /* not lint */
 
 #ifdef __linux__
@@ -99,6 +95,7 @@ extern        int ntrec;              /* blocking factor on tape */
 extern int cartridge;
 extern char *host;
 char   *nexttape;
+extern  pid_t rshpid;
 
 static ssize_t atomic_read __P((int, void *, size_t));
 static ssize_t atomic_write __P((int, const void *, size_t));
@@ -270,10 +267,19 @@ do_stats(void)
        time_t tnow, ttaken;
        int blocks;
 
+#ifdef __linux__
+       (void)time4(&tnow);
+#else
        (void)time(&tnow);
+#endif
        ttaken = tnow - tstart_volume;
        blocks = spcl.c_tapea - tapea_volume;
-       msg("Volume %d completed at: %s", tapeno, ctime(&tnow));
+       msg("Volume %d completed at: %s", tapeno, 
+#ifdef __linux__
+                                         ctime4(&tnow));
+#else
+                                         ctime(&tnow));
+#endif
        if (ttaken > 0) {
                msg("Volume %d took %d:%02d:%02d\n", tapeno,
                        ttaken / 3600, (ttaken % 3600) / 60, ttaken % 60);
@@ -299,7 +305,11 @@ statussig(int notused)
 
        if (blockswritten < 500)
                return;
+#ifdef __linux__
+       (void) time4(&tnow);
+#else
        (void) time((time_t *) &tnow);
+#endif
        deltat = tstart_writing - tnow + (1.0 * (tnow - tstart_writing))
                / blockswritten * tapesize;
        (void)snprintf(msgbuf, sizeof(msgbuf),
@@ -445,17 +455,10 @@ trewind(void)
 void
 close_rewind(void)
 {
-       time_t tstart_changevol, tend_changevol;
-
        trewind();
        (void)do_stats();
        if (nexttape)
                return;
-#ifdef  __linux__
-        (void)time4(&(tstart_changevol));
-#else
-       (void)time((time_t *)&(tstart_changevol));
-#endif
        if (!nogripe) {
                msg("Change Volumes: Mount volume #%d\n", tapeno+1);
                broadcast("CHANGE DUMP VOLUMES!\7\7\n");
@@ -465,13 +468,6 @@ close_rewind(void)
                        dumpabort(0);
                        /*NOTREACHED*/
                }
-#ifdef  __linux__
-       (void)time4(&(tend_changevol));
-#else
-       (void)time((time_t *)&(tend_changevol));
-#endif
-       if ((tstart_changevol != (time_t)-1) && (tend_changevol != (time_t)-1))
-               tstart_writing += (tend_changevol - tstart_changevol);
 }
 
 void
@@ -637,7 +633,11 @@ startnewtape(int top)
        interrupt_save = signal(SIGINT, SIG_IGN);
        parentpid = getpid();
        tapea_volume = spcl.c_tapea;
-       (void)time(&tstart_volume);
+#ifdef __linux__
+       (void)time4(&tstart_volume);
+#else
+       (void)time((&tstart_volume);
+#endif
 
 restore_check_point:
        (void)signal(SIGINT, interrupt_save);
@@ -662,7 +662,8 @@ restore_check_point:
                        tapeno+1, parentpid, childpid);
 #endif /* TDEBUG */
                while ((waitpid = wait(&status)) != childpid)
-                       msg("Parent %d waiting for child %d has another child %d return\n",
+                       if (waitpid != rshpid)
+                               msg("Parent %d waiting for child %d has another child %d return\n",
                                parentpid, childpid, waitpid);
                if (status & 0xFF) {
                        msg("Child %d returns LOB status %o\n",
@@ -750,7 +751,12 @@ restore_check_point:
                spcl.c_flags |= DR_NEWHEADER;
                writeheader((ino_t)slp->inode);
                spcl.c_flags &=~ DR_NEWHEADER;
-               msg("Volume %d started at: %s", tapeno, ctime(&tstart_volume));
+               msg("Volume %d started at: %s", tapeno, 
+#ifdef __linux__
+                                               ctime4(&tstart_volume));
+#else
+                                               ctime(&tstart_volume));
+#endif
                if (tapeno > 1)
                        msg("Volume %d begins with blocks from inode %d\n",
                                tapeno, slp->inode);