diff --git a/lib/gshadow.c b/lib/gshadow.c index 9194b1bcc..c9fdcc0ca 100644 --- a/lib/gshadow.c +++ b/lib/gshadow.c @@ -74,7 +74,7 @@ sgetsgent(const char *s) { static char *dup = NULL; - char *fields[FIELDS]; + char *fields[FIELDS]; char *cp; int i; diff --git a/lib/sgetgrent.c b/lib/sgetgrent.c index da5601ffc..8d675a3fe 100644 --- a/lib/sgetgrent.c +++ b/lib/sgetgrent.c @@ -69,10 +69,11 @@ struct group * sgetgrent(const char *s) { static char *dup = NULL; - static char *grpfields[NFIELDS]; static struct group grent; + int i; char *cp; + char *fields[NFIELDS]; free(dup); dup = strdup(s); @@ -82,21 +83,20 @@ sgetgrent(const char *s) stpsep(dup, "\n"); for (cp = dup, i = 0; (i < NFIELDS) && (NULL != cp); i++) - grpfields[i] = strsep(&cp, ":"); + fields[i] = strsep(&cp, ":"); - if (i < NFIELDS || streq(grpfields[2], "") || cp != NULL) { + if (i < NFIELDS || streq(fields[2], "") || cp != NULL) { return NULL; } - grent.gr_name = grpfields[0]; - grent.gr_passwd = grpfields[1]; - if (get_gid(grpfields[2], &grent.gr_gid) == -1) { + grent.gr_name = fields[0]; + grent.gr_passwd = fields[1]; + if (get_gid(fields[2], &grent.gr_gid) == -1) { return NULL; } - grent.gr_mem = list (grpfields[3]); + grent.gr_mem = list(fields[3]); if (NULL == grent.gr_mem) { return NULL; /* out of memory */ } return &grent; } - diff --git a/lib/sgetpwent.c b/lib/sgetpwent.c index 691979a19..7ece4dccb 100644 --- a/lib/sgetpwent.c +++ b/lib/sgetpwent.c @@ -44,9 +44,10 @@ sgetpwent(const char *s) { static char *dup = NULL; static struct passwd pwent; + int i; char *cp; - char *fields[NFIELDS]; + char *fields[NFIELDS]; free(dup); dup = strdup(s); diff --git a/lib/sgetspent.c b/lib/sgetspent.c index c4f742e0a..3ebc1cd64 100644 --- a/lib/sgetspent.c +++ b/lib/sgetspent.c @@ -41,6 +41,7 @@ sgetspent(const char *s) { static char *dup = NULL; static struct spwd spwd; + char *fields[FIELDS]; char *cp; int i;