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

Diff for /src/usr.bin/ssh/misc.c between version 1.102 and 1.103

version 1.102, 2016/03/02 22:42:40 version 1.103, 2016/04/02 14:37:42
Line 75 
Line 75 
 {  {
         int val;          int val;
   
         val = fcntl(fd, F_GETFL, 0);          val = fcntl(fd, F_GETFL);
         if (val < 0) {          if (val < 0) {
                 error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));                  error("fcntl(%d, F_GETFL): %s", fd, strerror(errno));
                 return (-1);                  return (-1);
         }          }
         if (val & O_NONBLOCK) {          if (val & O_NONBLOCK) {
Line 99 
Line 99 
 {  {
         int val;          int val;
   
         val = fcntl(fd, F_GETFL, 0);          val = fcntl(fd, F_GETFL);
         if (val < 0) {          if (val < 0) {
                 error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));                  error("fcntl(%d, F_GETFL): %s", fd, strerror(errno));
                 return (-1);                  return (-1);
         }          }
         if (!(val & O_NONBLOCK)) {          if (!(val & O_NONBLOCK)) {
Line 705 
Line 705 
                     strerror(errno));                      strerror(errno));
                 exit(1);                  exit(1);
         }          }
         while (++dupfd <= 2) {          while (++dupfd <= STDERR_FILENO) {
                 /* Only clobber closed fds */                  /* Only populate closed fds. */
                 if (fcntl(dupfd, F_GETFL, 0) >= 0)                  if (fcntl(dupfd, F_GETFL) == -1 && errno == EBADF) {
                         continue;                          if (dup2(nullfd, dupfd) == -1) {
                 if (dup2(nullfd, dupfd) == -1) {                                  fprintf(stderr, "dup2: %s\n", strerror(errno));
                         fprintf(stderr, "dup2: %s\n", strerror(errno));                                  exit(1);
                         exit(1);                          }
                 }                  }
         }          }
         if (nullfd > 2)          if (nullfd > STDERR_FILENO)
                 close(nullfd);                  close(nullfd);
 }  }
   

Legend:
Removed from v.1.102  
changed lines
  Added in v.1.103