From 6c13ede68e0cb8f1f8312c875047b991b6b86ca1 Mon Sep 17 00:00:00 2001 From: Benjamin Marzinski Date: Thu, 11 Dec 2008 16:10:27 -0600 Subject: [PATCH] Fix for parsing multipath.conf files without spaces before brackets There's a bug in bug in the multipath.conf code that keeps multipath from correctly parsing config files where there is no space between a section name and the opening bracket. For instance devices { device { ... } } works but devices { device{ ... } } doesn't. This patch makes sure that brackets are the recognized as seperate from the token that they follow, unless they are part of a quoted string. Signed-off-by: Benjamin Marzinski --- libmultipath/parser.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libmultipath/parser.c b/libmultipath/parser.c index 070745d..f1fdeb8 100644 --- a/libmultipath/parser.c +++ b/libmultipath/parser.c @@ -239,12 +239,20 @@ alloc_strvec(char *string) in_string = 0; else in_string = 1; + } else if (!in_string && (*cp == '{' || *cp == '}')) { + token = MALLOC(2); + + if (!token) + goto out; + *(token) = *cp; + *(token + 1) = '\0'; + cp++; } else { while ((in_string || (!isspace((int) *cp) && isascii((int) *cp) && - *cp != '!' && *cp != '#')) && - *cp != '\0' && *cp != '"') + *cp != '!' && *cp != '#' && *cp != '{' && + *cp != '}')) && *cp != '\0' && *cp != '"') cp++; strlen = cp - start; token = MALLOC(strlen + 1); -- 2.7.4