]> git.wh0rd.org - dump.git/commitdiff
The -F script is called now *only* at the end of a tape.
authorStelian Pop <stelian@popies.net>
Sun, 28 May 2000 16:24:13 +0000 (16:24 +0000)
committerStelian Pop <stelian@popies.net>
Sun, 28 May 2000 16:24:13 +0000 (16:24 +0000)
Use posix signal handling to preserve dump functionality with libc5.

CHANGES
THANKS
dump.spec
dump/tape.c

diff --git a/CHANGES b/CHANGES
index d48e25534ea57ab7b67cf8024eb7509eaf70ad90..bd892616cb962ae6d2bb8ed0eeb348f9de1bbe50 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,15 @@
-$Id: CHANGES,v 1.54 2000/03/11 15:34:54 stelian Exp $
+$Id: CHANGES,v 1.55 2000/05/28 16:24:13 stelian Exp $
+
+Changes between versions 0.4b16 and 0.4b17 (released ??????????????)
+====================================================================
+
+1.     The -F script is called now *only* at the end of a tape,
+       not at the end of the dump. Thanks to Chris
+       <haul@informatik.tu-darmstadt.de> for the bug report.
+
+2.     Use posix signal handling to preserve dump functionality 
+       with libc5. Thanks to Jeff Johnson <jbj@redhat.com> for
+       the patch.
 
 Changes between versions 0.4b15 and 0.4b16 (released March 11, 2000)
 ====================================================================
diff --git a/THANKS b/THANKS
index 91533cdfed499f563ff438882a4620c2022910c8..ed4d8b2c0a4b05de1c87125aff4a209c756bde30 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -1,4 +1,4 @@
-$Id: THANKS,v 1.25 2000/03/08 11:25:58 stelian Exp $
+$Id: THANKS,v 1.26 2000/05/28 16:24:13 stelian Exp $
 
 Dump and restore were written by the people of the CSRG at the University
 of California, Berkeley.
@@ -24,6 +24,7 @@ Here is a partial list of them (if I have forgotten someone, please complain):
 
 Stephen Carr           sgcarr@civeng.adelaide.edu.au
 Rob Cermak             cermak@ahab.rutgers.edu
+Chris                  haul@informatik.tu-darmstadt.de
 Isaac Chuang           ike@isl.stanford.edu
 Rainer Clasen          bj@ncc.cicely.de
 W. Reilly Cooley       wcooley@nakedape.cc
@@ -34,6 +35,7 @@ Jeremy Fitzhardinge   jeremy@goop.org
 Eirik Fuller           eirik@netcom.com
 Jean-Paul van der Jagt jeanpaul@dutepp0.et.tudelft.nl
 Eric Jergensen         eric@dvns.com
+Jeff Johnson           jbj@redhat.com
 Henry Katz             hkatz@hkatz.dialup.access.net
 Klaus Kudielka         kkudielk@cacofonix.nt.tuwien.ac.at
 Thorsten Kukuk         kukuk@suse.de
index 57a8947e386735955b3e01fa532e19324b3ea6d4..55a9c203956ad64570c5a81dff06fb90367f91df 100644 (file)
--- a/dump.spec
+++ b/dump.spec
@@ -52,7 +52,7 @@ This packages contains statically linked versions of dump and restore.
 
 %build
 
-%configure --with-binmode=6755 --with-manowner=root --with-mangrp=root --with-manmode=0644 --enable-static
+./configure --prefix=/usr --with-binmode=6755 --with-manowner=root --with-mangrp=root --with-manmode=0644 --enable-static
 
 make OPT="$RPM_OPT_FLAGS -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts"
 
@@ -61,7 +61,7 @@ mv restore/restore restore/restore.static
 
 make distclean
 
-%configure --with-binmode=6755 --with-manowner=root --with-mangrp=root --with-manmode=0644 --enable-rmt
+./configure --prefix=/usr --with-binmode=6755 --with-manowner=root --with-mangrp=root --with-manmode=0644 --enable-rmt
 
 make OPT="$RPM_OPT_FLAGS -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts"
 
@@ -98,16 +98,16 @@ rm -rf $RPM_BUILD_ROOT
 /sbin/rdump
 %attr(6755,root,tty)   /sbin/restore
 /sbin/rrestore
-%{_prefix}/man/man8/dump.8
-%{_prefix}/man/man8/rdump.8
-%{_prefix}/man/man8/restore.8
-%{_prefix}/man/man8/rrestore.8
+%{_prefix}/man/man8/dump.*
+%{_prefix}/man/man8/rdump.*
+%{_prefix}/man/man8/restore.*
+%{_prefix}/man/man8/rrestore.*
 
 %files -n rmt
 %defattr(-,root,root)
 %attr(0755,root,root)  /sbin/rmt
 /etc/rmt
-%{_prefix}/man/man8/rmt.
+%{_prefix}/man/man8/rmt.*
 
 %files -n dump-static
 %defattr(-,root,root)
index 925c088b89e97b99cfeda7e022efad1d75a4bdd2..69715003e67bf772103bfad8d0b5d996a64c03ec 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.18 2000/03/11 15:29:01 stelian Exp $";
+       "$Id: tape.c,v 1.19 2000/05/28 16:24:14 stelian Exp $";
 #endif /* not lint */
 
 #ifdef __linux__
@@ -496,7 +496,7 @@ trewind(void)
                        (void) close(f);
                }
                eot_code = 1;
-               if (eot_script) {
+               if (eot_script && spcl.c_type != TS_END) {
                        msg("Launching %s\n", eot_script);
                        eot_code = system_command(eot_script, tape, tapeno);
                }
@@ -617,12 +617,13 @@ rollforward(void)
        }
        slp->req[0] = *q;
        nextblock = slp->tblock;
-       if (q->dblk == 0)
+       if (q->dblk == 0) {
 #ifdef __linux__
-               *(union u_spcl *)(*(nextblock)++) = *(union u_spcl *)tslp->tblock;
-#else
-               nextblock++;
+       /* XXX post increment triggers an egcs-1.1.2-12 bug on alpha/sparc */
+               *(union u_spcl *)(*nextblock) = *(union u_spcl *)tslp->tblock;
 #endif
+               nextblock++;
+       }
        trecno = 1;
 
        /*
@@ -676,17 +677,21 @@ startnewtape(int top)
        int     status;
        int     waitpid;
        char    *p;
+
 #ifdef __linux__
-       void    (*interrupt_save)  __P((int signo));
+       sigset_t sigs;
+       sigemptyset(&sigs);
+       sigaddset(&sigs, SIGINT);
+       sigprocmask(SIG_BLOCK, &sigs, NULL);
 #else  /* __linux__ */
 #ifdef sunos
        void    (*interrupt_save)();
 #else
        sig_t   interrupt_save;
 #endif
+       interrupt_save = signal(SIGINT, SIG_IGN);
 #endif /* __linux__ */
 
-       interrupt_save = signal(SIGINT, SIG_IGN);
        parentpid = getpid();
        tapea_volume = spcl.c_tapea;
 #ifdef __linux__
@@ -696,7 +701,11 @@ startnewtape(int top)
 #endif
 
 restore_check_point:
+#ifdef __linux__
+       sigprocmask(SIG_UNBLOCK, &sigs, NULL);
+#else
        (void)signal(SIGINT, interrupt_save);
+#endif
        /*
         *      All signals are inherited...
         */
@@ -712,7 +721,11 @@ restore_check_point:
                 *      until the child doing all of the work returns.
                 *      don't catch the interrupt
                 */
+#ifdef __linux__
+               sigprocmask(SIG_BLOCK, &sigs, NULL);
+#else
                signal(SIGINT, SIG_IGN);
+#endif
 #ifdef TDEBUG
                msg("Tape: %d; parent process: %d child process %d\n",
                        tapeno+1, parentpid, childpid);
@@ -860,10 +873,9 @@ Exit(int status)
 static void
 proceed(int signo)
 {
-
+       caught++;
        if (ready)
                siglongjmp(jmpbuf, 1);
-       caught++;
 }
 
 void
@@ -878,10 +890,17 @@ enslave(void)
 
        master = getpid();
 
-       signal(SIGTERM, dumpabort);  /* Slave sends SIGTERM on dumpabort() */
-       signal(SIGPIPE, sigpipe);
-       signal(SIGUSR1, tperror);    /* Slave sends SIGUSR1 on tape errors */
-       signal(SIGUSR2, proceed);    /* Slave sends SIGUSR2 to next slave */
+    {  struct sigaction sa;
+       sa.sa_handler = dumpabort;
+       sigaction(SIGTERM, &sa, NULL); /* Slave sends SIGTERM on dumpabort() */
+       sa.sa_handler = sigpipe;
+       sigaction(SIGPIPE, &sa, NULL);
+       sa.sa_handler = tperror;
+       sigaction(SIGUSR1, &sa, NULL); /* Slave sends SIGUSR1 on tape errors */
+       sa.sa_handler = proceed;
+       sa.sa_flags = SA_RESTART;
+       sigaction(SIGUSR2, &sa, NULL); /* Slave sends SIGUSR2 to next slave */
+   }
 
        for (i = 0; i < SLAVES; i++) {
                if (i == slp - &slaves[0]) {
@@ -898,12 +917,15 @@ enslave(void)
                slaves[i].fd = cmd[1];
                slaves[i].sent = 0;
                if (slaves[i].pid == 0) {           /* Slave starts up here */
+                       sigset_t sigs;
                        for (j = 0; j <= i; j++)
                                (void) close(slaves[j].fd);
-                       signal(SIGINT, SIG_IGN);    /* Master handles this */
+                       sigemptyset(&sigs);
+                       sigaddset(&sigs, SIGINT);  /* Master handles this */
 #if defined(SIGINFO)
-                       signal(SIGINFO, SIG_IGN);
+                       sigaddset(&sigs, SIGINFO);
 #endif
+                       sigprocmask(SIG_BLOCK, &sigs, NULL);
 
 #ifdef LINUX_FORK_BUG
                        if (atomic_write( cmd[0], (char *) &i, sizeof i)
@@ -1003,7 +1025,7 @@ doslave(int cmd, int slave_number)
                                       quit("master/slave protocol botched.\n");
                        }
                }
-               if (setjmp(jmpbuf) == 0) {
+               if (sigsetjmp(jmpbuf, 1) == 0) {
                        ready = 1;
                        if (!caught)
                                (void) pause();