summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJorgen Lundman <[email protected]>2021-07-08 12:08:13 +0900
committerTony Hutter <[email protected]>2021-09-14 12:37:38 -0700
commita0b4da22978b0a062cc7a0c0127904ccc4abf5c2 (patch)
tree61d9bd730d4b241bedd43083165ea9a20922c639 /lib
parentc84670950ad8c0c5bc1e65d81b3727bfa791d8f9 (diff)
Replace strchrnul() with strrchr()
Could have gone either way with this one, either adding it to macOS/Windows SPL, or returning it to "classic" usage with strrchr(). Since the new special way isn't really used, and only used once, we have this commit. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Jorgen Lundman <[email protected]> Closes #12312
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/libzfs_pool.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c
index adc36c47f..58056ac70 100644
--- a/lib/libzfs/libzfs_pool.c
+++ b/lib/libzfs/libzfs_pool.c
@@ -4871,7 +4871,9 @@ zpool_load_compat(const char *compat, boolean_t *features, char *report,
line != NULL;
line = strtok_r(NULL, "\n", &ls)) {
/* discard comments */
- *(strchrnul(line, '#')) = '\0';
+ char *r = strchr(line, '#');
+ if (r != NULL)
+ *r = '\0';
for (word = strtok_r(line, ", \t", &ws);
word != NULL;