From 62ba8d23e33d009e202968408924d00441fe587a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 14 Jun 2014 16:38:47 +0200 Subject: [PATCH] tracking down concurrency issus is fun. --- libs/pbd/pathscanner.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/pbd/pathscanner.cc b/libs/pbd/pathscanner.cc index 6d3cba8d77..b60e1eee1a 100644 --- a/libs/pbd/pathscanner.cc +++ b/libs/pbd/pathscanner.cc @@ -24,6 +24,7 @@ using PBD::readdir; using PBD::opendir; using PBD::closedir; +#define strtok_r strtok_s // @john: this should probably go to msvc_extra_headers/ardourext/misc.h.input instead of the current define there #else #include #include @@ -105,8 +106,9 @@ PathScanner::run_scan_internal (vector *result, string search_str; string *newstr; long nfound = 0; + char *saveptr; - if ((thisdir = strtok (pathcopy, G_SEARCHPATH_SEPARATOR_S)) == 0 || + if ((thisdir = strtok_r (pathcopy, G_SEARCHPATH_SEPARATOR_S, &saveptr)) == 0 || strlen (thisdir) == 0) { free (pathcopy); return 0; @@ -170,7 +172,7 @@ PathScanner::run_scan_internal (vector *result, } closedir (dir); - } while ((limit < 0 || (nfound < limit)) && (thisdir = strtok (0, G_SEARCHPATH_SEPARATOR_S))); + } while ((limit < 0 || (nfound < limit)) && (thisdir = strtok_r (0, G_SEARCHPATH_SEPARATOR_S, &saveptr))); free (pathcopy); return result;