Permalink
Browse files

use strtok_r in functions running within threads

  • Loading branch information...
1 parent e87fe01 commit b3a7ec885d998a0a36e2a2861d298d32b9a451ea @falconindy committed Feb 2, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 cower.c
View
@@ -1098,7 +1098,7 @@ unsigned long openssl_thread_id(void) /* {{{ */
alpm_list_t *parse_bash_array(alpm_list_t *deplist, char *array, pkgdetail_t type) /* {{{ */
{
- char *ptr, *token;
+ char *ptr, *token, *saveptr;
if(!array) {
return NULL;
@@ -1128,10 +1128,11 @@ alpm_list_t *parse_bash_array(alpm_list_t *deplist, char *array, pkgdetail_t typ
return deplist;
}
- for(token = strtok(array, " \t\n"); token; token = strtok(NULL, " \t\n")) {
+ for(token = strtok_r(array, " \t\n", &saveptr); token;
+ token = strtok_r(NULL, " \t\n", &saveptr)) {
/* found an embedded comment. skip to the next line */
if(*token == '#') {
- strtok(NULL, "\n");
+ strtok_r(NULL, "\n", &saveptr);
continue;
}

0 comments on commit b3a7ec8

Please sign in to comment.