From 4f1a87a245b960f1cd1fb4fe40b4254ac3793213 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Mon, 11 May 2009 18:22:19 +0530 Subject: booster: Supplement fstab option parsing Previous fstab option parsing logic was completely retarded and did not handle all cases. This fixes the situation so we now work without any problems. Signed-off-by: Anand V. Avati --- booster/src/booster.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'booster/src/booster.c') diff --git a/booster/src/booster.c b/booster/src/booster.c index de5bd325365..b9d870d8cb5 100644 --- a/booster/src/booster.c +++ b/booster/src/booster.c @@ -263,18 +263,26 @@ get_option_value (char *opt) char *val = NULL; char *saveptr = NULL; char *copy_opt = NULL; - char *nextopt = NULL; char *retval = NULL; copy_opt = strdup (opt); - val = strtok_r (copy_opt, "=", &saveptr); - if (val != NULL) { - nextopt = index (val, ','); - if (nextopt) - *nextopt = '\0'; + /* Get the = before the value of the option. */ + val = index (copy_opt, '='); + if (val) { + /* Move to start of option */ + ++val; + + /* Now, to create a '\0' delimited string out of the + * options string, first get the position where the + * next option starts, that would be the next ','. + */ + saveptr = index (val, ','); + if (saveptr) + *saveptr = '\0'; retval = strdup (val); } + free (copy_opt); return retval; -- cgit