diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1996-11-04 18:13:39 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1996-11-04 18:13:39 +0000 |
commit | 5d6e6f99dbd123c003b7e8bccc2c8ba83c62288b (patch) | |
tree | bc1037742e3e34a0da8d132bf54090557dd60f2b /usr.sbin | |
parent | 4092be6550a507aba4c49e6eb3ae3935aae36ef5 (diff) |
Don't use access(2) -- from Theo.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/lpr/lpr/lpr.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/usr.sbin/lpr/lpr/lpr.c b/usr.sbin/lpr/lpr/lpr.c index ee2986aadcd..4e077a64d9e 100644 --- a/usr.sbin/lpr/lpr/lpr.c +++ b/usr.sbin/lpr/lpr/lpr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lpr.c,v 1.10 1996/11/03 23:24:12 millert Exp $ */ +/* $OpenBSD: lpr.c,v 1.11 1996/11/04 18:13:38 millert Exp $ */ /* $NetBSD: lpr.c,v 1.10 1996/03/21 18:12:25 jtc Exp $ */ /* @@ -592,11 +592,11 @@ test(file) register int fd; register char *cp; - if (access(file, 4) < 0) { - printf("%s: cannot access %s\n", name, file); + if ((fd = open(file, O_RDONLY)) < 0) { + printf("%s: cannot open %s\n", name, file); goto bad; } - if (stat(file, &statb) < 0) { + if (fstat(fd, &statb) < 0) { printf("%s: cannot stat %s\n", name, file); goto bad; } @@ -608,10 +608,6 @@ test(file) printf("%s: %s is an empty file\n", name, file); goto bad; } - if ((fd = open(file, O_RDONLY)) < 0) { - printf("%s: cannot open %s\n", name, file); - goto bad; - } if (read(fd, &execb, sizeof(execb)) == sizeof(execb) && !N_BADMAG(execb)) { printf("%s: %s is an executable program and is unprintable", |