lib/, src/: Use strsep(3) instead of its pattern

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-07-01 21:40:11 -05:00
committed by Serge Hallyn
parent 8176e309ed
commit 16cb664865
7 changed files with 29 additions and 64 deletions
+3 -7
View File
@@ -83,17 +83,13 @@ static struct spwd *my_sgetspent (const char *string)
* FIELDS different fields.
*/
for (cp = spwbuf, i = 0; *cp && i < FIELDS; i++) {
fields[i] = cp;
cp = strchrnul(cp, ':');
if (*cp)
*cp++ = '\0';
}
for (cp = spwbuf, i = 0; cp != NULL && i < FIELDS; i++)
fields[i] = strsep(&cp, ":");
if (i == (FIELDS - 1))
fields[i++] = empty;
if ((cp && *cp) || (i != FIELDS && i != OFIELDS))
if (cp != NULL || (i != FIELDS && i != OFIELDS))
return 0;
/*