version 1.23, 2002/07/31 22:08:42 |
version 1.24, 2003/02/02 18:38:22 |
|
|
#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> |
|
|
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; |
} |
} |