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

Diff for /src/usr.bin/ssh/readpass.c between version 1.22 and 1.22.2.1

version 1.22, 2001/07/14 15:10:16 version 1.22.2.1, 2001/11/14 03:24:39
Line 47 
Line 47 
 {  {
         pid_t pid;          pid_t pid;
         size_t len;          size_t len;
         char *nl, *pass;          char *pass;
         int p[2], status;          int p[2], status;
         char buf[1024];          char buf[1024];
   
Line 73 
Line 73 
                 fatal("ssh_askpass: exec(%s): %s", askpass, strerror(errno));                  fatal("ssh_askpass: exec(%s): %s", askpass, strerror(errno));
         }          }
         close(p[1]);          close(p[1]);
         len = read(p[0], buf, sizeof buf);          len = read(p[0], buf, sizeof buf -1);
         close(p[0]);          close(p[0]);
         while (waitpid(pid, &status, 0) < 0)          while (waitpid(pid, &status, 0) < 0)
                 if (errno != EINTR)                  if (errno != EINTR)
                         break;                          break;
         if (len <= 1)          if (len <= 1)
                 return xstrdup("");                  return xstrdup("");
         nl = strchr(buf, '\n');          buf[len] = '\0';
         if (nl)          buf[strcspn(buf, "\r\n")] = '\0';
                 *nl = '\0';  
         pass = xstrdup(buf);          pass = xstrdup(buf);
         memset(buf, 0, sizeof(buf));          memset(buf, 0, sizeof(buf));
         return pass;          return pass;

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.22.2.1