[BACK]Return to apply.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / apply

Diff for /src/usr.bin/apply/apply.c between version 1.9 and 1.10

version 1.9, 2001/07/09 07:04:47 version 1.10, 2001/09/04 23:35:58
Line 198 
Line 198 
 {  {
         static char *name, *shell;          static char *name, *shell;
         pid_t pid;          pid_t pid;
         int omask, pstat;          int pstat;
           sigset_t mask, omask;
         sig_t intsave, quitsave;          sig_t intsave, quitsave;
   
         if (shell == NULL) {          if (shell == NULL) {
Line 212 
Line 213 
         if (!command)           /* just checking... */          if (!command)           /* just checking... */
                 return(1);                  return(1);
   
         omask = sigblock(sigmask(SIGCHLD));          sigemptyset(&mask);
           sigaddset(&mask, SIGCHLD);
           sigprocmask(SIG_BLOCK, &mask, &omask);
         switch(pid = fork()) {          switch(pid = fork()) {
         case -1:                        /* error */          case -1:                        /* error */
                 err(1, "fork");                  err(1, "fork");
         case 0:                         /* child */          case 0:                         /* child */
                 (void)sigsetmask(omask);                  sigprocmask(SIG_SETMASK, &omask, NULL);
                 execl(shell, name, "-c", command, (char *)NULL);                  execl(shell, name, "-c", command, (char *)NULL);
                 err(1, "%s", shell);                  err(1, "%s", shell);
         }          }
         intsave = signal(SIGINT, SIG_IGN);          intsave = signal(SIGINT, SIG_IGN);
         quitsave = signal(SIGQUIT, SIG_IGN);          quitsave = signal(SIGQUIT, SIG_IGN);
         pid = waitpid(pid, &pstat, 0);          pid = waitpid(pid, &pstat, 0);
         (void)sigsetmask(omask);          sigprocmask(SIG_SETMASK, &omask, NULL);
         (void)signal(SIGINT, intsave);          (void)signal(SIGINT, intsave);
         (void)signal(SIGQUIT, quitsave);          (void)signal(SIGQUIT, quitsave);
         return(pid == -1 ? -1 : pstat);          return(pid == -1 ? -1 : pstat);

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10