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

Diff for /src/usr.bin/ssh/authfile.c between version 1.135 and 1.136

version 1.135, 2019/09/03 08:30:47 version 1.136, 2020/01/02 22:38:33
Line 545 
Line 545 
         return (*cp == '\0' && quoted) ? -1 : 0;          return (*cp == '\0' && quoted) ? -1 : 0;
 }  }
   
   /* Save a public key */
   int
   sshkey_save_public(const struct sshkey *key, const char *path,
       const char *comment)
   {
           int fd, oerrno;
           FILE *f = NULL;
           int r = SSH_ERR_INTERNAL_ERROR;
   
           if ((fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1)
                   return SSH_ERR_SYSTEM_ERROR;
           if ((f = fdopen(fd, "w")) == NULL) {
                   r = SSH_ERR_SYSTEM_ERROR;
                   goto fail;
           }
           if ((r = sshkey_write(key, f)) != 0)
                   goto fail;
           fprintf(f, " %s\n", comment);
           if (ferror(f) || fclose(f) != 0) {
                   r = SSH_ERR_SYSTEM_ERROR;
    fail:
                   oerrno = errno;
                   if (f != NULL)
                           fclose(f);
                   else
                           close(fd);
                   errno = oerrno;
                   return r;
           }
           return 0;
   }

Legend:
Removed from v.1.135  
changed lines
  Added in v.1.136