summaryrefslogtreecommitdiffstats
path: root/booster
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-11 18:22:19 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-18 19:12:27 +0530
commit4f1a87a245b960f1cd1fb4fe40b4254ac3793213 (patch)
tree34f1dc55f7ccc3e484db719ffeaeaf91b9a9a078 /booster
parenta5301c874f978570187c3543b0c3a4ceba143c25 (diff)
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 <avati@amp.gluster.com>
Diffstat (limited to 'booster')
-rw-r--r--booster/src/booster.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c
index de5bd32..b9d870d 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;