]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string
authorAlejandro Colomar <alx@kernel.org>
Mon, 20 May 2024 14:22:56 +0000 (16:22 +0200)
committerSerge Hallyn <serge@hallyn.com>
Tue, 2 Jul 2024 02:40:11 +0000 (21:40 -0500)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/shadow.c

index f17d09ee71fb08cf3c60a8862e31d459f5134bab..ab8f5d2a5c58671fd6a52e051fbd908b31754a77 100644 (file)
@@ -60,11 +60,12 @@ void endspent (void)
 
 static struct spwd *my_sgetspent (const char *string)
 {
-       static char spwbuf[BUFSIZ];
-       static struct spwd spwd;
-       char *fields[FIELDS];
-       char *cp;
-       int i;
+       int                 i;
+       char                *fields[FIELDS];
+       char                *cp;
+       static char         spwbuf[BUFSIZ];
+       static char         empty[] = "";
+       static struct spwd  spwd;
 
        /*
         * Copy string to local buffer.  It has to be tokenized and we
@@ -94,7 +95,7 @@ static struct spwd *my_sgetspent (const char *string)
        }
 
        if (i == (FIELDS - 1))
-               fields[i++] = cp;
+               fields[i++] = empty;
 
        if ((cp && *cp) || (i != FIELDS && i != OFIELDS))
                return 0;