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

Diff for /src/usr.bin/chpass/edit.c between version 1.23 and 1.24

version 1.23, 2002/07/31 22:08:42 version 1.24, 2003/02/02 18:38:22
Line 48 
Line 48 
 #include <ctype.h>  #include <ctype.h>
 #include <err.h>  #include <err.h>
 #include <errno.h>  #include <errno.h>
   #include <fcntl.h>
 #include <paths.h>  #include <paths.h>
 #include <pwd.h>  #include <pwd.h>
 #include <stdio.h>  #include <stdio.h>
Line 152 
Line 153 
         char *p, *q;          char *p, *q;
         ENTRY *ep;          ENTRY *ep;
         FILE *fp;          FILE *fp;
           int fd;
   
         if (!(fp = fopen(tempname, "r")))          if ((fd = open(tempname, O_RDONLY|O_NOFOLLOW)) == -1 ||
               (fp = fdopen(fd, "r")) == NULL)
                 pw_error(tempname, 1, 1);                  pw_error(tempname, 1, 1);
         if (fstat(fileno(fp), &sb))          if (fstat(fd, &sb))
                 pw_error(tempname, 1, 1);                  pw_error(tempname, 1, 1);
         if (sb.st_size == 0) {          if (sb.st_size == 0 || sb.st_nlink != 1) {
                 warnx("corrupted temporary file");                  warnx("corrupted temporary file");
                 goto bad;                  goto bad;
         }          }

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24