From: Alejandro Colomar Date: Wed, 1 Jan 2025 00:04:38 +0000 (+0100) Subject: lib/: Treat strpbrk(3)'s return value as a boolean X-Git-Tag: 4.18.0-rc1~72 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38e295153241ee55dddd5b7ab570e16ef2f60f85;p=thirdparty%2Fshadow.git lib/: Treat strpbrk(3)'s return value as a boolean with the meaning "a character was found". strpbrk(3) is just like strchr(3), but searches for multiple characters. Both functions have a boolean-like return value, which evaluates to true if a character was found. A better name for strpbrk(3) would have been strchrs(). Signed-off-by: Alejandro Colomar --- diff --git a/lib/fields.c b/lib/fields.c index 9e08adadf..ef8283741 100644 --- a/lib/fields.c +++ b/lib/fields.c @@ -43,7 +43,7 @@ int valid_field (const char *field, const char *illegal) /* For each character of field, search if it appears in the list * of illegal characters. */ - if (illegal && NULL != strpbrk (field, illegal)) { + if (illegal && strpbrk(field, illegal)) { return -1; } diff --git a/lib/setupenv.c b/lib/setupenv.c index 1bc3da314..29e2aac3c 100644 --- a/lib/setupenv.c +++ b/lib/setupenv.c @@ -73,7 +73,7 @@ static void read_env_file (const char *filename) val = stpsep(cp, "="); if (val == NULL) continue; - if (strpbrk(name, " \t") != NULL) + if (strpbrk(name, " \t")) continue; #if 0 /* XXX untested, and needs rewrite with fewer goto's :-) */ /*