File hostlist-fix-use-of-strchr.patch of Package pdsh.30882
From: Mark A. Grondona <mark.grondona@gmail.com>
Date: Thu Aug 12 18:51:55 2021 -0700
Subject: hostlist: fix use of strchr()
Patch-mainline: Not yet
Git-repo: https://github.com/chaos/pdsh
Git-commit: 8ad5f4ff5dcccb87d6723cb36aa8097b27fdae6a
References:
Problem: Comparison of strchr() result to NUL results in compiler
warnings.
Test strchr() result against NULL instead to avoid the compiler
warnings.
Signed-off-by: Egbert Eich <eich@suse.de>
---
src/common/hostlist.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/common/hostlist.c b/src/common/hostlist.c
index d7c9bb9..69edc43 100644
--- a/src/common/hostlist.c
+++ b/src/common/hostlist.c
@@ -369,7 +369,7 @@ static char * _next_tok(char *sep, char **str)
int level = 0;
/* push str past any leading separators */
- while (**str != '\0' && strchr(sep, **str) != '\0')
+ while (**str != '\0' && strchr(sep, **str))
(*str)++;
if (**str == '\0')
@@ -378,7 +378,7 @@ static char * _next_tok(char *sep, char **str)
/* assign token ptr */
tok = *str;
- while ( **str != '\0' &&
+ while ( **str != '\0' &&
(level != 0 || strchr(sep, **str) == NULL) ) {
if ( **str == '[' ) level++;
else if ( **str == ']' ) level--;
@@ -386,7 +386,7 @@ static char * _next_tok(char *sep, char **str)
}
/* nullify consecutive separators and push str beyond them */
- while (**str != '\0' && strchr(sep, **str) != '\0')
+ while (**str != '\0' && strchr(sep, **str) != NULL)
*(*str)++ = '\0';
return tok;