summaryrefslogtreecommitdiff
path: root/apt-pkg/aptconfiguration.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2015-10-23 20:39:56 +0200
committerJulian Andres Klode <jak@debian.org>2015-10-30 14:20:11 +0100
commit1843d82ff5f8712778062cc08ed991e1dee42b6e (patch)
tree19acc1964eb68fe7e008fe5e23d9ce99f00625ce /apt-pkg/aptconfiguration.cc
parent308d0cf53f4b7ad1750fb1efb42b908c8e336b9f (diff)
aptconfiguration: Convert strtok() to strtok_r()
strtok() is not thread-safe, whereas strtok_r() is. Gbp-Dch: ignore
Diffstat (limited to 'apt-pkg/aptconfiguration.cc')
-rw-r--r--apt-pkg/aptconfiguration.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index 69f6f6f8d..c15332c7a 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -382,8 +382,9 @@ std::vector<std::string> const Configuration::getArchitectures(bool const &Cache
FILE *dpkg = fdopen(external[0], "r");
if(dpkg != NULL) {
char buf[1024];
+ char *tok_buf;
while (fgets(buf, sizeof(buf), dpkg) != NULL) {
- char* arch = strtok(buf, " ");
+ char* arch = strtok_r(buf, " ", &tok_buf);
while (arch != NULL) {
for (; isspace(*arch) != 0; ++arch);
if (arch[0] != '\0') {
@@ -393,7 +394,7 @@ std::vector<std::string> const Configuration::getArchitectures(bool const &Cache
if (std::find(archs.begin(), archs.end(), a) == archs.end())
archs.push_back(a);
}
- arch = strtok(NULL, " ");
+ arch = strtok_r(NULL, " ", &tok_buf);
}
}
fclose(dpkg);