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

Diff for /src/usr.bin/mail/popen.c between version 1.25 and 1.26

version 1.25, 2001/01/16 05:36:08 version 1.26, 2001/01/19 04:11:29
Line 224 
Line 224 
   
 /*  /*
  * Run a command without a shell, with optional arguments and splicing   * Run a command without a shell, with optional arguments and splicing
  * of stdin and stdout.  The command name can be a sequence of words.   * of stdin (-1 means none) and stdout.  The command name can be a sequence
    * of words.
  * Signals must be handled by the caller.   * Signals must be handled by the caller.
  * "nset" contains the signals to ignore in the new process.   * "nset" contains the signals to ignore in the new process.
  * SIGINT is enabled unless it's in "nset".   * SIGINT is enabled unless it's in "nset".
Line 321 
Line 322 
          * All file descriptors other than 0, 1, and 2 are supposed to be           * All file descriptors other than 0, 1, and 2 are supposed to be
          * close-on-exec.           * close-on-exec.
          */           */
         if (infd >= 0) {          if (infd > 0) {
                 dup2(infd, 0);                  dup2(infd, 0);
         } else {          } else if (infd != 0) {
                 /* we don't want the child stealing my stdin input */                  /* we don't want the child stealing my stdin input */
                 close(0);                  close(0);
                 open(_PATH_DEVNULL, O_RDONLY, 0);                  open(_PATH_DEVNULL, O_RDONLY, 0);
         }          }
         if (outfd >= 0)          if (outfd >= 0 && outfd != 1)
                 dup2(outfd, 1);                  dup2(outfd, 1);
         if (nset == NULL)          if (nset == NULL)
                 return;                  return;

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26