mirror of
https://github.com/shadow-maint/shadow.git
synced 2024-12-05 07:53:34 +08:00
lib/list.c: is_on_list(): Move break condition to loop controlling expression
This change executes `i++` one more time before breaking, so we need to update the `i+1` after the loop to just `i`. Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
parent
fb01e07e83
commit
46fd68c37e
@ -232,15 +232,13 @@ bool is_on_list (char *const *list, const char *member)
|
||||
* array of pointers.
|
||||
*/
|
||||
|
||||
for (cp = members, i = 0;; i++) {
|
||||
for (cp = members, i = 0; cp != NULL; i++) {
|
||||
array[i] = cp;
|
||||
cp = strchr(cp, ',');
|
||||
if (NULL != cp)
|
||||
*cp++ = '\0';
|
||||
else
|
||||
break;
|
||||
}
|
||||
array[i+1] = NULL;
|
||||
array[i] = NULL;
|
||||
|
||||
/*
|
||||
* Return the new array of pointers
|
||||
|
Loading…
Reference in New Issue
Block a user