Commit c4dbf1de authored by Linus Torvalds's avatar Linus Torvalds

strtok -> strsep fixes

parent bcbcfa85
......@@ -66,9 +66,9 @@ static int devpts_parse_options(char *options, struct devpts_sb_info *sbi)
char *this_char, *value;
this_char = NULL;
if ( options )
this_char = strtok(options,",");
for ( ; this_char; this_char = strtok(NULL,",")) {
while ((this_char = strsep(&options, ",")) != NULL) {
if (!*this_char)
continue;
if ((value = strchr(this_char,'=')) != NULL)
*value++ = 0;
if (!strcmp(this_char,"uid")) {
......
......@@ -221,9 +221,9 @@ static int parse_options (char * options, unsigned long * sb_block,
if (!options)
return 1;
for (this_char = strtok (options, ",");
this_char != NULL;
this_char = strtok (NULL, ",")) {
while ((this_char = strsep (&options, ",")) != NULL) {
if (!*this_char)
continue;
if ((value = strchr (this_char, '=')) != NULL)
*value++ = 0;
if (!strcmp (this_char, "bsddf"))
......
......@@ -554,9 +554,9 @@ static int parse_options (char * options, unsigned long * sb_block,
if (!options)
return 1;
for (this_char = strtok (options, ",");
this_char != NULL;
this_char = strtok (NULL, ",")) {
while ((this_char = strsep (&options, ",")) != NULL) {
if (!*this_char)
continue;
if ((value = strchr (this_char, '=')) != NULL)
*value++ = 0;
if (!strcmp (this_char, "bsddf"))
......
......@@ -224,8 +224,9 @@ static int parse_options(char *options, int *debug,
goto out;
save = 0;
savep = NULL;
for (this_char = strtok(options,","); this_char;
this_char = strtok(NULL,",")) {
while ((this_char = strsep(&options,",")) != NULL) {
if (!*this_char)
continue;
if ((value = strchr(this_char,'=')) != NULL) {
save = *value;
savep = value;
......
......@@ -120,12 +120,12 @@ static char *presto_options(char *options, char *cache_data,
store_opt(prestodev, NULL, PRESTO_PSDEV_NAME "0");
CDEBUG(D_SUPER, "parsing options\n");
for (this_char = strtok (options, ",");
this_char != NULL;
this_char = strtok (NULL, ",")) {
while ((this_char = strsep (&options, ",")) != NULL) {
char *opt;
CDEBUG(D_SUPER, "this_char %s\n", this_char);
if (!*this_char)
continue;
if ( (opt = read_opt("fileset", this_char)) ) {
store_opt(fileset, opt, NULL);
continue;
......
......@@ -202,8 +202,9 @@ static void __init root_nfs_parse(char *name, char *buf)
if ((options = strchr(name, ','))) {
*options++ = 0;
cp = strtok(options, ",");
while (cp) {
while ((cp = strsep(&options, ",")) != NULL) {
if (!*cp)
continue;
if ((val = strchr(cp, '='))) {
struct nfs_int_opts *opts = root_int_opts;
*val++ = '\0';
......@@ -220,7 +221,6 @@ static void __init root_nfs_parse(char *name, char *buf)
nfs_data.flags |= opts->or_mask;
}
}
cp = strtok(NULL, ",");
}
}
if (name[0] && strcmp(name, "default")) {
......
......@@ -133,8 +133,11 @@ static int parse_options(char *options,uid_t *uid,gid_t *gid)
*uid = current->uid;
*gid = current->gid;
if (!options) return 1;
for (this_char = strtok(options,","); this_char; this_char = strtok(NULL,",")) {
if (!options)
return 1;
while ((this_char = strsep(&options,",")) != NULL) {
if (!*this_char)
continue;
if ((value = strchr(this_char,'=')) != NULL)
*value++ = 0;
if (!strcmp(this_char,"uid")) {
......
......@@ -286,8 +286,9 @@ udf_parse_options(char *options, struct udf_options *uopt)
if (!options)
return 1;
for (opt = strtok(options, ","); opt; opt = strtok(NULL, ","))
{
while ((opt = strsep(&options, ",") != NULL) {
if (!*opt)
continue;
/* Make "opt=val" into two strings */
val = strchr(opt, '=');
if (val)
......
......@@ -257,11 +257,10 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
if (!options)
return 1;
for (this_char = strtok (options, ",");
this_char != NULL;
this_char = strtok (NULL, ",")) {
while ((this_char = strsep (&options, ",")) != NULL) {
if (!*this_char)
continue;
if ((value = strchr (this_char, '=')) != NULL)
*value++ = 0;
if (!strcmp (this_char, "ufstype")) {
......
......@@ -115,7 +115,9 @@ static int parse_options(char *options, struct fat_mount_options *opts)
save = 0;
savep = NULL;
ret = 1;
for (this_char = strtok(options,","); this_char; this_char = strtok(NULL,",")) {
while ((this_char = strsep(&options,",")) != NULL) {
if (!*this_char)
continue;
if ((value = strchr(this_char,'=')) != NULL) {
save = *value;
savep = value;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment