Fix parsing of mount options specified with -o in case an option with

value is preceded by an option without value (for example -o
option1,option2=value). Options must be separated before searching for
'='. Also compare pnextopt explicitly against NULL.

PR:		bin/134069
Approved by:	trasz (mentor)
This commit is contained in:
Jaakko Heinonen 2009-10-26 14:57:33 +00:00
parent e99c18762e
commit bdb403798c

View File

@ -232,16 +232,16 @@ main(int argc, char *argv[])
char *pnextopt = NULL; char *pnextopt = NULL;
char *val = ""; char *val = "";
pass_flag_to_nmount = 1; pass_flag_to_nmount = 1;
pval = strchr(opt, '=');
pnextopt = strchr(opt, ','); pnextopt = strchr(opt, ',');
if (pnextopt != NULL) {
*pnextopt = '\0';
pnextopt++;
}
pval = strchr(opt, '=');
if (pval != NULL) { if (pval != NULL) {
*pval = '\0'; *pval = '\0';
val = pval + 1; val = pval + 1;
} }
if (pnextopt) {
*pnextopt = '\0';
pnextopt++;
}
if (strcmp(opt, "bg") == 0) { if (strcmp(opt, "bg") == 0) {
opflags |= BGRND; opflags |= BGRND;
pass_flag_to_nmount=0; pass_flag_to_nmount=0;