aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2018-05-28 18:29:15 +0000
committerEd Maste <emaste@FreeBSD.org>2018-05-28 18:29:15 +0000
commit0eff530775f94be45fba133eb58db0693751df2e (patch)
treebdb156d69ea9906256f3119e99cf3fa59d9f4cad /lib
parent5bd0cf6dc8b92b5bcb0e0710a5ef4535e8a9155d (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/string/strsep.37
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/string/strsep.3 b/lib/libc/string/strsep.3
index e888ecfaa850..0dbf1294db27 100644
--- a/lib/libc/string/strsep.3
+++ b/lib/libc/string/strsep.3
@@ -86,9 +86,10 @@ to parse a string, and prints each token in separate line:
char *token, *string, *tofree;
tofree = string = strdup("abc,def,ghi");
-if (string != NULL)
- while ((token = strsep(&string, ",")) != NULL)
- printf("%s\en", token);
+if (string == NULL)
+ err(1, "strdup");
+while ((token = strsep(&string, ",")) != NULL)
+ printf("%s\en", token);
free(tofree);
.Ed