Commit 6b76ca09 6b76ca09ca0964440800cd2614ff95f3d250826c by Sergey Poznyakoff

(mu_spawnvp): Minor fixes

1 parent 986fc6f1
...@@ -613,7 +613,7 @@ mu_tempname (const char *tmpdir) ...@@ -613,7 +613,7 @@ mu_tempname (const char *tmpdir)
613 * to find it. 613 * to find it.
614 */ 614 */
615 int 615 int
616 mu_spawnvp (const char* prog, const char* const av_[], int* stat) 616 mu_spawnvp (const char *prog, const char *const av_[], int *stat)
617 { 617 {
618 pid_t pid; 618 pid_t pid;
619 int err = 0; 619 int err = 0;
...@@ -623,7 +623,7 @@ mu_spawnvp (const char* prog, const char* const av_[], int* stat) ...@@ -623,7 +623,7 @@ mu_spawnvp (const char* prog, const char* const av_[], int* stat)
623 struct sigaction savequit; 623 struct sigaction savequit;
624 sigset_t chldmask; 624 sigset_t chldmask;
625 sigset_t savemask; 625 sigset_t savemask;
626 char** av = (char**) av_; 626 char **av = (char **) av_;
627 627
628 if (!prog || !av) 628 if (!prog || !av)
629 return EINVAL; 629 return EINVAL;
...@@ -635,13 +635,20 @@ mu_spawnvp (const char* prog, const char* const av_[], int* stat) ...@@ -635,13 +635,20 @@ mu_spawnvp (const char* prog, const char* const av_[], int* stat)
635 if (sigaction (SIGINT, &ignore, &saveintr) < 0) 635 if (sigaction (SIGINT, &ignore, &saveintr) < 0)
636 return errno; 636 return errno;
637 if (sigaction (SIGQUIT, &ignore, &savequit) < 0) 637 if (sigaction (SIGQUIT, &ignore, &savequit) < 0)
638 return errno; 638 {
639 sigaction (SIGINT, &saveintr, NULL);
640 return errno;
641 }
639 642
640 sigemptyset (&chldmask); /* now block SIGCHLD */ 643 sigemptyset (&chldmask); /* now block SIGCHLD */
641 sigaddset (&chldmask, SIGCHLD); 644 sigaddset (&chldmask, SIGCHLD);
642 645
643 if (sigprocmask (SIG_BLOCK, &chldmask, &savemask) < 0) 646 if (sigprocmask (SIG_BLOCK, &chldmask, &savemask) < 0)
644 return errno; 647 {
648 sigaction (SIGINT, &saveintr, NULL);
649 sigaction (SIGQUIT, &savequit, NULL);
650 return errno;
651 }
645 652
646 #ifdef HAVE_VFORK 653 #ifdef HAVE_VFORK
647 pid = vfork (); 654 pid = vfork ();
...@@ -675,7 +682,7 @@ mu_spawnvp (const char* prog, const char* const av_[], int* stat) ...@@ -675,7 +682,7 @@ mu_spawnvp (const char* prog, const char* const av_[], int* stat)
675 err = errno; /* error other than EINTR from waitpid() */ 682 err = errno; /* error other than EINTR from waitpid() */
676 break; 683 break;
677 } 684 }
678 if(err == 0 && stat) 685 if (err == 0 && stat)
679 *stat = progstat; 686 *stat = progstat;
680 } 687 }
681 688
......