diff options
author | Jorgen Lundman <lundman@lundman.net> | 2021-07-08 03:08:13 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 03:08:13 +0000 |
commit | d2119d0e6f411be5418f88fdb9b64e5c7b808fce (patch) | |
tree | 86e3d29dca27cf482d8f62a1dc4cffd25561a9bb | |
parent | eb5983e1b7b46f9159f9efc76f2a59e3dd3a21c2 (diff) | |
download | src-d2119d0e6f411be5418f88fdb9b64e5c7b808fce.tar.gz src-d2119d0e6f411be5418f88fdb9b64e5c7b808fce.zip |
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 <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Closes #12312
-rw-r--r-- | lib/libzfs/libzfs_pool.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index c0bf9d067d42..7338b9d72cad 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; |