aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/getopt.c5
-rw-r--r--util-linux/mount.c3
-rw-r--r--util-linux/setpriv.c9
-rw-r--r--util-linux/switch_root.c4
4 files changed, 12 insertions, 9 deletions
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index db7db6ff8..1fa402429 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -289,12 +289,13 @@ static struct option *add_long_options(struct option *long_options, char *option
289{ 289{
290 int long_nr = 0; 290 int long_nr = 0;
291 int arg_opt, tlen; 291 int arg_opt, tlen;
292 char *tokptr = strtok(options, ", \t\n"); 292 char *tokptr;
293 293
294 if (long_options) 294 if (long_options)
295 while (long_options[long_nr].name) 295 while (long_options[long_nr].name)
296 long_nr++; 296 long_nr++;
297 297
298 tokptr = strtok_r(options, ", \t\n", &options);
298 while (tokptr) { 299 while (tokptr) {
299 arg_opt = no_argument; 300 arg_opt = no_argument;
300 tlen = strlen(tokptr); 301 tlen = strlen(tokptr);
@@ -318,7 +319,7 @@ static struct option *add_long_options(struct option *long_options, char *option
318 long_nr++; 319 long_nr++;
319 /*memset(&long_options[long_nr], 0, sizeof(long_options[0])); - xrealloc_vector did it */ 320 /*memset(&long_options[long_nr], 0, sizeof(long_options[0])); - xrealloc_vector did it */
320 } 321 }
321 tokptr = strtok(NULL, ", \t\n"); 322 tokptr = strtok_r(NULL, ", \t\n", &options);
322 } 323 }
323 return long_options; 324 return long_options;
324} 325}
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 19ac13930..fc5161d7f 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1230,6 +1230,7 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
1230 * then data pointer is interpreted as a string. */ 1230 * then data pointer is interpreted as a string. */
1231 struct nfs_mount_data data; 1231 struct nfs_mount_data data;
1232 char *opt; 1232 char *opt;
1233 char *tokstate;
1233 struct hostent *hp; 1234 struct hostent *hp;
1234 struct sockaddr_in server_addr; 1235 struct sockaddr_in server_addr;
1235 struct sockaddr_in mount_server_addr; 1236 struct sockaddr_in mount_server_addr;
@@ -1348,7 +1349,7 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
1348 nfsvers = 0; 1349 nfsvers = 0;
1349 1350
1350 /* parse options */ 1351 /* parse options */
1351 if (filteropts) for (opt = strtok(filteropts, ","); opt; opt = strtok(NULL, ",")) { 1352 if (filteropts) for (opt = strtok_r(filteropts, ",", &tokstate); opt; opt = strtok_r(NULL, ",", &tokstate)) {
1352 char *opteq = strchr(opt, '='); 1353 char *opteq = strchr(opt, '=');
1353 if (opteq) { 1354 if (opteq) {
1354 int val, idx; 1355 int val, idx;
diff --git a/util-linux/setpriv.c b/util-linux/setpriv.c
index 37e8821a1..1e4b201ed 100644
--- a/util-linux/setpriv.c
+++ b/util-linux/setpriv.c
@@ -144,10 +144,11 @@ static unsigned parse_cap(const char *cap)
144static void set_inh_caps(char *capstring) 144static void set_inh_caps(char *capstring)
145{ 145{
146 struct caps caps; 146 struct caps caps;
147 char *string;
147 148
148 getcaps(&caps); 149 getcaps(&caps);
149 150
150 capstring = strtok(capstring, ","); 151 capstring = strtok_r(capstring, ",", &string);
151 while (capstring) { 152 while (capstring) {
152 unsigned cap; 153 unsigned cap;
153 154
@@ -159,7 +160,7 @@ static void set_inh_caps(char *capstring)
159 caps.data[CAP_TO_INDEX(cap)].inheritable |= CAP_TO_MASK(cap); 160 caps.data[CAP_TO_INDEX(cap)].inheritable |= CAP_TO_MASK(cap);
160 else 161 else
161 caps.data[CAP_TO_INDEX(cap)].inheritable &= ~CAP_TO_MASK(cap); 162 caps.data[CAP_TO_INDEX(cap)].inheritable &= ~CAP_TO_MASK(cap);
162 capstring = strtok(NULL, ","); 163 capstring = strtok_r(NULL, ",", &string);
163 } 164 }
164 165
165 if (capset(&caps.header, caps.data) != 0) 166 if (capset(&caps.header, caps.data) != 0)
@@ -170,7 +171,7 @@ static void set_ambient_caps(char *string)
170{ 171{
171 char *cap; 172 char *cap;
172 173
173 cap = strtok(string, ","); 174 cap = strtok_r(string, ",", &string);
174 while (cap) { 175 while (cap) {
175 unsigned idx; 176 unsigned idx;
176 177
@@ -182,7 +183,7 @@ static void set_ambient_caps(char *string)
182 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_LOWER, idx, 0, 0) < 0) 183 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_LOWER, idx, 0, 0) < 0)
183 bb_simple_perror_msg("cap_ambient_lower"); 184 bb_simple_perror_msg("cap_ambient_lower");
184 } 185 }
185 cap = strtok(NULL, ","); 186 cap = strtok_r(NULL, ",", &string);
186 } 187 }
187} 188}
188#endif /* FEATURE_SETPRIV_CAPABILITIES */ 189#endif /* FEATURE_SETPRIV_CAPABILITIES */
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index c65096c27..f2674b5ac 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -164,7 +164,7 @@ static void drop_capabilities(char *string)
164{ 164{
165 char *cap; 165 char *cap;
166 166
167 cap = strtok(string, ","); 167 cap = strtok_r(string, ",", &string);
168 while (cap) { 168 while (cap) {
169 unsigned cap_idx; 169 unsigned cap_idx;
170 170
@@ -174,7 +174,7 @@ static void drop_capabilities(char *string)
174 drop_bounding_set(cap_idx); 174 drop_bounding_set(cap_idx);
175 drop_capset(cap_idx); 175 drop_capset(cap_idx);
176 bb_error_msg("dropped capability: %s", cap); 176 bb_error_msg("dropped capability: %s", cap);
177 cap = strtok(NULL, ","); 177 cap = strtok_r(NULL, ",", &string);
178 } 178 }
179} 179}
180#endif 180#endif