]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/, src/: Use consistent style using strchr(3) in conditionals
authorAlejandro Colomar <alx@kernel.org>
Thu, 4 Jul 2024 17:00:53 +0000 (19:00 +0200)
committerSerge Hallyn <serge@hallyn.com>
Sun, 21 Sep 2025 23:55:20 +0000 (18:55 -0500)
commit8b197967469deec88cfae5129a70f97e26cadbd2
tree57dcd05df05b0b58e77ce06de66bcbc9145d3b3b
parent79ddd58ef6bfbdc40da29e2f23fc3b91c8c51045
lib/, src/: Use consistent style using strchr(3) in conditionals

While the return value is a pointer, it can be interpreted as a boolean
value meaning "found".  In general, we use explicit comparisons of
pointers to NULL, but in this specific case, let's use that
interpretation, and make an exception, using an implicit conversion to
boolean.

For negative matches, use
if (!strchr(...))

For positive matches, use
if (strchr(...))

For positive matches, when a variable is also set, use
while (NULL != (p = strchr(...)))

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/env.c
lib/obscure.c
lib/setupenv.c
lib/tcbfuncs.c
src/chfn.c
src/chpasswd.c
src/login_nopam.c
src/su.c