summaryrefslogtreecommitdiff
path: root/util-linux/getopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/getopt.c')
-rw-r--r--util-linux/getopt.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index db7db6f..1fa4024 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
{
int long_nr = 0;
int arg_opt, tlen;
- char *tokptr = strtok(options, ", \t\n");
+ char *tokptr;
if (long_options)
while (long_options[long_nr].name)
long_nr++;
+ tokptr = strtok_r(options, ", \t\n", &options);
while (tokptr) {
arg_opt = no_argument;
tlen = strlen(tokptr);
@@ -318,7 +319,7 @@ static struct option *add_long_options(struct option *long_options, char *option
long_nr++;
/*memset(&long_options[long_nr], 0, sizeof(long_options[0])); - xrealloc_vector did it */
}
- tokptr = strtok(NULL, ", \t\n");
+ tokptr = strtok_r(NULL, ", \t\n", &options);
}
return long_options;
}