[tor-commits] [torsocks/master] Fix: use strtok_r reentrant instead of strtok
dgoulet at torproject.org
dgoulet at torproject.org
Fri Apr 4 22:40:27 UTC 2014
commit 6f4b45b91f75dadfdc4dad967e47c4cd1b2ce036
Author: David Goulet <dgoulet at ev0ke.net>
Date: Thu Feb 20 12:37:40 2014 +0000
Fix: use strtok_r reentrant instead of strtok
Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
src/common/utils.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/common/utils.c b/src/common/utils.c
index 3a62f6c..ba34e33 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -119,7 +119,7 @@ ATTR_HIDDEN
int utils_tokenize_ignore_comments(const char *_line, size_t size, char **tokens)
{
int ret, i = 0, argc = 0;
- char *c, *line = NULL;
+ char *c, *line = NULL, *saveptr;
assert(_line);
assert(tokens);
@@ -150,14 +150,14 @@ int utils_tokenize_ignore_comments(const char *_line, size_t size, char **tokens
goto error;
}
- c = strtok(line, " \t");
+ c = strtok_r(line, " \t", &saveptr);
while (c != NULL) {
tokens[i] = strdup(c);
if (!tokens[i]) {
ret = -ENOMEM;
goto error;
}
- c = strtok(NULL, " \t");
+ c = strtok_r(NULL, " \t", &saveptr);
i++;
}
More information about the tor-commits
mailing list