summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8389947)
raw | patch | inline | side by side (parent: 8389947)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 30 Nov 2006 11:02:46 +0000 (12:02 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 2 Dec 2006 17:02:43 +0000 (18:02 +0100) |
strtok() internally uses a static buffer and thus is not thread-safe.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Sebastian Harl <sh@tokkee.org>
src/email.c | patch | blob | history |
diff --git a/src/email.c b/src/email.c
index 27370aee683bfb44a2f9d33e6674a79e7c772294..37194fb1f6d55575785fe064507488659a53ac9f 100644 (file)
--- a/src/email.c
+++ b/src/email.c
}
if ('e' == line[0]) { /* e:<type>:<bytes> */
- char *type = strtok (line + 2, ":");
- char *tmp = strtok (NULL, ":");
+ char *ptr = NULL;
+ char *type = strtok_r (line + 2, ":", &ptr);
+ char *tmp = strtok_r (NULL, ":", &ptr);
int bytes = 0;
if (NULL == tmp) {
pthread_mutex_unlock (&score_mutex);
}
else if ('c' == line[0]) { /* c:<type1>[,<type2>,...] */
- char *type = strtok (line + 2, ",");
+ char *ptr = NULL;
+ char *type = strtok_r (line + 2, ",", &ptr);
do {
pthread_mutex_lock (&check_mutex);
type_list_incr (&check, type, 1);
pthread_mutex_unlock (&check_mutex);
- } while (NULL != (type = strtok (NULL, ",")));
+ } while (NULL != (type = strtok_r (NULL, ",", &ptr)));
}
else {
syslog (LOG_ERR, "email: unknown type '%c'", line[0]);