diff options
Diffstat (limited to 'contrib/mtree/getid.c')
-rw-r--r-- | contrib/mtree/getid.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/contrib/mtree/getid.c b/contrib/mtree/getid.c index 3079180d8f20..2c9e641500ec 100644 --- a/contrib/mtree/getid.c +++ b/contrib/mtree/getid.c @@ -1,4 +1,4 @@ -/* $NetBSD: getid.c,v 1.8 2013/10/16 17:27:42 christos Exp $ */ +/* $NetBSD: getid.c,v 1.10 2014/10/27 21:46:45 christos Exp $ */ /* from: NetBSD: getpwent.c,v 1.48 2000/10/03 03:22:26 enami Exp */ /* from: NetBSD: getgrent.c,v 1.41 2002/01/12 23:51:30 lukem Exp */ @@ -65,7 +65,7 @@ #endif #include <sys/cdefs.h> -__RCSID("$NetBSD: getid.c,v 1.8 2013/10/16 17:27:42 christos Exp $"); +__RCSID("$NetBSD: getid.c,v 1.10 2014/10/27 21:46:45 christos Exp $"); #include <sys/param.h> @@ -206,7 +206,12 @@ grstart(void) } if (grfile[0] == '\0') /* sanity check */ return 0; - return (_gr_fp = fopen(grfile, "r")) ? 1 : 0; + + _gr_fp = fopen(grfile, "r"); + if (_gr_fp != NULL) + return 1; + warn("Can't open `%s'", grfile); + return 0; } @@ -231,7 +236,7 @@ grscan(int search, gid_t gid, const char *name) continue; } /* skip comments */ - if (pwline[0] == '#') + if (grline[0] == '#') continue; if (grmatchline(search, gid, name)) return 1; @@ -350,7 +355,11 @@ pwstart(void) } if (pwfile[0] == '\0') /* sanity check */ return 0; - return (_pw_fp = fopen(pwfile, "r")) ? 1 : 0; + _pw_fp = fopen(pwfile, "r"); + if (_pw_fp != NULL) + return 1; + warn("Can't open `%s'", pwfile); + return 0; } |