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

Diff for /src/usr.bin/ssh/readconf.c between version 1.336 and 1.337

version 1.336, 2020/10/03 08:30:47 version 1.337, 2020/10/03 09:22:26
Line 495 
Line 495 
 {  {
         char *shell;          char *shell;
         pid_t pid;          pid_t pid;
         int devnull, status;          int status;
   
         if ((shell = getenv("SHELL")) == NULL)          if ((shell = getenv("SHELL")) == NULL)
                 shell = _PATH_BSHELL;                  shell = _PATH_BSHELL;
Line 505 
Line 505 
                     shell, strerror(errno));                      shell, strerror(errno));
         }          }
   
         /* Need this to redirect subprocess stdin/out */  
         if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1)  
                 fatal("open(/dev/null): %s", strerror(errno));  
   
         debug("Executing command: '%.500s'", cmd);          debug("Executing command: '%.500s'", cmd);
   
         /* Fork and execute the command. */          /* Fork and execute the command. */
         if ((pid = fork()) == 0) {          if ((pid = fork()) == 0) {
                 char *argv[4];                  char *argv[4];
   
                 /* Redirect child stdin and stdout. Leave stderr */                  if (stdfd_devnull(1, 1, 0) == -1)
                 if (dup2(devnull, STDIN_FILENO) == -1)                          fatal("%s: stdfd_devnull failed", __func__);
                         fatal("dup2: %s", strerror(errno));  
                 if (dup2(devnull, STDOUT_FILENO) == -1)  
                         fatal("dup2: %s", strerror(errno));  
                 if (devnull > STDERR_FILENO)  
                         close(devnull);  
                 closefrom(STDERR_FILENO + 1);                  closefrom(STDERR_FILENO + 1);
   
                 argv[0] = shell;                  argv[0] = shell;
Line 539 
Line 530 
         /* Parent. */          /* Parent. */
         if (pid == -1)          if (pid == -1)
                 fatal("%s: fork: %.100s", __func__, strerror(errno));                  fatal("%s: fork: %.100s", __func__, strerror(errno));
   
         close(devnull);  
   
         while (waitpid(pid, &status, 0) == -1) {          while (waitpid(pid, &status, 0) == -1) {
                 if (errno != EINTR && errno != EAGAIN)                  if (errno != EINTR && errno != EAGAIN)

Legend:
Removed from v.1.336  
changed lines
  Added in v.1.337