dfde8dec4c
Signed-off-by: Karel Zak <kzak@redhat.com>
37 lines
1.1 KiB
Diff
37 lines
1.1 KiB
Diff
From 5e7b834002aa0ce97a1b0104e8710664ad954595 Mon Sep 17 00:00:00 2001
|
|
From: Dave Reisner <dreisner@archlinux.org>
|
|
Date: Sun, 3 Jun 2012 12:25:47 -0400
|
|
Subject: [PATCH] libmount: trim leading commas from each options string
|
|
|
|
Fixes a bug in option string parsing wherein a line such as:
|
|
|
|
ro,relatime,,nosuid,nodev
|
|
|
|
Will be seen as only the tokens "ro" and "relatime" after the parser
|
|
encounters a zero length (and erroneously declared NULL) option.
|
|
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
---
|
|
libmount/src/optstr.c | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c
|
|
index af5953b..66d2a06 100644
|
|
--- a/libmount/src/optstr.c
|
|
+++ b/libmount/src/optstr.c
|
|
@@ -62,6 +62,11 @@ static int mnt_optstr_parse_next(char **optstr, char **name, size_t *namesz,
|
|
if (valsz)
|
|
*valsz = 0;
|
|
|
|
+ /* trim leading commas as to not invalidate option
|
|
+ * strings with multiple consecutive commas */
|
|
+ while (optstr0 && *optstr0 == ',')
|
|
+ optstr0++;
|
|
+
|
|
for (p = optstr0; p && *p; p++) {
|
|
if (!start)
|
|
start = p; /* begin of the option item */
|
|
--
|
|
1.7.11.7
|
|
|