]> git.wh0rd.org - dump.git/blobdiff - dump/tape.c
Empty the sigaction structure to be portable.
[dump.git] / dump / tape.c
index 69715003e67bf772103bfad8d0b5d996a64c03ec..63b64260db1d73cf928b5dd426def5feaf650771 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.19 2000/05/28 16:24:14 stelian Exp $";
+       "$Id: tape.c,v 1.23 2000/08/30 08:55:21 stelian Exp $";
 #endif /* not lint */
 
 #ifdef __linux__
@@ -422,7 +422,11 @@ int system_command(const char *command, const char *device, int volnum) {
        if (pid == 0) {
                setuid(getuid());
                setgid(getgid());
+#if OLD_STYLE_FSCRIPT
+               snprintf(commandstr, sizeof(commandstr), "%s", command);
+#else
                snprintf(commandstr, sizeof(commandstr), "%s %s %d", command, device, volnum);
+#endif
                commandstr[sizeof(commandstr) - 1] = '\0';
                execl("/bin/sh", "sh", "-c", commandstr, NULL);
                perror("  DUMP: unable to execute shell");
@@ -873,9 +877,9 @@ Exit(int status)
 static void
 proceed(int signo)
 {
-       caught++;
        if (ready)
                siglongjmp(jmpbuf, 1);
+       caught++;
 }
 
 void
@@ -891,6 +895,8 @@ enslave(void)
        master = getpid();
 
     {  struct sigaction sa;
+       memset(&sa, 0, sizeof sa);
+       sigemptyset(&sa.sa_mask);
        sa.sa_handler = dumpabort;
        sigaction(SIGTERM, &sa, NULL); /* Slave sends SIGTERM on dumpabort() */
        sa.sa_handler = sigpipe;
@@ -1077,6 +1083,7 @@ doslave(int cmd, int slave_number)
                if (wrote < 0) {
                        (void) kill(master, SIGUSR1);
                        sigemptyset(&sigset);
+                       sigaddset(&sigset, SIGINT);
                        for (;;)
                                sigsuspend(&sigset);
                } else {