Skip to content

Commit

Permalink
Replace strchrnul() with strrchr()
Browse files Browse the repository at this point in the history
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  openzfs#12312
  • Loading branch information
lundman authored and behlendorf committed Aug 24, 2021
1 parent c12675f commit a90f2d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/libzfs/libzfs_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a90f2d9

Please sign in to comment.