mirror of
https://github.com/opnsense/src.git
synced 2026-04-21 06:07:31 -04:00
strsep.3: don't silently ignore errors
Reported by: bde MFC with: r334275
This commit is contained in:
parent
5bd0cf6dc8
commit
0eff530775
1 changed files with 4 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue