Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/mtree don't bother initialising pwfile[] to _PATH_M...



details:   https://anonhg.NetBSD.org/src/rev/ada3199243f5
branches:  trunk
changeset: 521352:ada3199243f5
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Jan 29 00:29:32 2002 +0000

description:
don't bother initialising pwfile[] to _PATH_MASTERPASSWD and grfile[]
to _PATH_GROUP, because the simple_get{pw,gr}*() functions should not
be called by anything before those path arrays are setup by setup_getid().

diffstat:

 usr.sbin/mtree/getid.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 37f1598eb547 -r ada3199243f5 usr.sbin/mtree/getid.c
--- a/usr.sbin/mtree/getid.c    Tue Jan 29 00:07:27 2002 +0000
+++ b/usr.sbin/mtree/getid.c    Tue Jan 29 00:29:32 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getid.c,v 1.1 2002/01/24 03:20:12 lukem Exp $  */
+/*     $NetBSD: getid.c,v 1.2 2002/01/29 00:29:32 lukem 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 */
 
@@ -112,8 +112,8 @@
 static int             _pw_stayopen;   /* keep fd's open */
 static int             _pw_filesdone;
 
-static char            grfile[MAXPATHLEN] = _PATH_GROUP;
-static char            pwfile[MAXPATHLEN] = _PATH_MASTERPASSWD;
+static char            grfile[MAXPATHLEN];
+static char            pwfile[MAXPATHLEN];
 
 static char            *members[MAXGRP];
 static char            grline[MAXLINELENGTH];
@@ -208,6 +208,8 @@
                rewind(_gr_fp);
                return 1;
        }
+       if (grfile[0] == '\0')                  /* sanity check */
+               return 0;
        return (_gr_fp = fopen(grfile, "r")) ? 1 : 0;
 }
 
@@ -347,6 +349,8 @@
                rewind(_pw_fp);
                return 1;
        }
+       if (pwfile[0] == '\0')                  /* sanity check */
+               return 0;
        return (_pw_fp = fopen(pwfile, "r")) ? 1 : 0;
 }
 



Home | Main Index | Thread Index | Old Index