diff options
Diffstat (limited to 'meta-openembedded/meta-oe/recipes-support/multipath-tools/files/0027-RH-warn-on-invalid-regex-instead-of-failing.patch')
-rw-r--r-- | meta-openembedded/meta-oe/recipes-support/multipath-tools/files/0027-RH-warn-on-invalid-regex-instead-of-failing.patch | 76 |
1 files changed, 44 insertions, 32 deletions
diff --git a/meta-openembedded/meta-oe/recipes-support/multipath-tools/files/0027-RH-warn-on-invalid-regex-instead-of-failing.patch b/meta-openembedded/meta-oe/recipes-support/multipath-tools/files/0027-RH-warn-on-invalid-regex-instead-of-failing.patch index a23e167393..57d04d02bb 100644 --- a/meta-openembedded/meta-oe/recipes-support/multipath-tools/files/0027-RH-warn-on-invalid-regex-instead-of-failing.patch +++ b/meta-openembedded/meta-oe/recipes-support/multipath-tools/files/0027-RH-warn-on-invalid-regex-instead-of-failing.patch @@ -1,7 +1,10 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Benjamin Marzinski <bmarzins@redhat.com> -Date: Mon, 6 Nov 2017 21:39:28 -0600 -Subject: [PATCH] RH: warn on invalid regex instead of failing +From d16de70b76919269561b4e404825f78286ea9a40 Mon Sep 17 00:00:00 2001 +From: Changqing Li <changqing.li@windriver.com> +Date: Mon, 26 Nov 2018 10:31:30 +0800 +Subject: [PATCH] From 0000000000000000000000000000000000000000 Mon Sep 17 + 00:00:00 2001 From: Benjamin Marzinski <bmarzins@redhat.com> Date: Mon, 6 Nov + 2017 21:39:28 -0600 Subject: [PATCH] RH: warn on invalid regex instead of + failing multipath.conf used to allow "*" as a match everything regular expression, instead of requiring ".*". Instead of erroring when the old style @@ -9,48 +12,56 @@ regular expressions are used, it should print a warning and convert them. Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> + +Upstream-Status: Pending + +update this patch to new version + +Signed-off-by: Changqing Li <changqing.li@windriver.com> --- - libmultipath/dict.c | 27 +++++++++++++++++++++------ + libmultipath/dict.c | 29 ++++++++++++++++++++++------- libmultipath/parser.c | 13 +++++++++++++ - libmultipath/parser.h | 1 + - 3 files changed, 35 insertions(+), 6 deletions(-) + libmultipath/parser.h | 2 +- + 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/libmultipath/dict.c b/libmultipath/dict.c -index 7ad0f5a..ab808d6 100644 +index a81c051..0689763 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c -@@ -55,6 +55,21 @@ set_str(vector strvec, void *ptr) +@@ -59,6 +59,21 @@ set_str(vector strvec, void *ptr) } static int +set_regex(vector strvec, void *ptr) +{ -+ char **str_ptr = (char **)ptr; ++ char **str_ptr = (char **)ptr; + -+ if (*str_ptr) -+ FREE(*str_ptr); -+ *str_ptr = set_regex_value(strvec); ++ if (*str_ptr) ++ FREE(*str_ptr); ++ *str_ptr = set_regex_value(strvec); + -+ if (!*str_ptr) -+ return 1; ++ if (!*str_ptr) ++ return 1; + -+ return 0; ++ return 0; +} + +static int set_yes_no(vector strvec, void *ptr) { char * buff; -@@ -1271,7 +1286,7 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \ +@@ -1346,8 +1361,8 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \ + \ if (!conf->option) \ return 1; \ - \ +- \ - buff = set_value(strvec); \ ++ \ + buff = set_regex_value(strvec); \ if (!buff) \ return 1; \ \ -@@ -1287,7 +1302,7 @@ ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec) \ +@@ -1363,7 +1378,7 @@ ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec) \ if (!conf->option) \ return 1; \ \ @@ -59,7 +70,7 @@ index 7ad0f5a..ab808d6 100644 if (!buff) \ return 1; \ \ -@@ -1388,16 +1403,16 @@ device_handler(struct config *conf, vector strvec) +@@ -1466,16 +1481,16 @@ device_handler(struct config *conf, vector strvec) return 0; } @@ -81,37 +92,38 @@ index 7ad0f5a..ab808d6 100644 declare_hw_handler(hwhandler, set_str) diff --git a/libmultipath/parser.c b/libmultipath/parser.c -index b8b7e0d..34b4ad2 100644 +index 92ef7cf..0e2cf49 100644 --- a/libmultipath/parser.c +++ b/libmultipath/parser.c -@@ -380,6 +380,19 @@ set_value(vector strvec) +@@ -384,6 +384,19 @@ set_value(vector strvec) return alloc; } +void * +set_regex_value(vector strvec) +{ -+ char *buff = set_value(strvec); ++ char *buff = set_value(strvec); + -+ if (buff && strcmp("*", buff) == 0) { -+ condlog(0, "Invalid regular expression \"*\" in multipath.conf. Using \".*\""); -+ FREE(buff); -+ return strdup(".*"); -+ } -+ return buff; ++ if (buff && strcmp("*", buff) == 0) { ++ condlog(0, "Invalid regular expression \"*\" in multipath.conf. Using \".*\""); ++ FREE(buff); ++ return strdup(".*"); ++ } ++ return buff; +} + /* non-recursive configuration stream handler */ static int kw_level = 0; diff --git a/libmultipath/parser.h b/libmultipath/parser.h -index 62906e9..b791705 100644 +index 62906e9..b6899fc 100644 --- a/libmultipath/parser.h +++ b/libmultipath/parser.h -@@ -77,6 +77,7 @@ extern void dump_keywords(vector keydump, int level); +@@ -76,7 +76,7 @@ extern int _install_keyword(vector keywords, char *string, + extern void dump_keywords(vector keydump, int level); extern void free_keywords(vector keywords); extern vector alloc_strvec(char *string); - extern void *set_value(vector strvec); +-extern void *set_value(vector strvec); +extern void *set_regex_value(vector strvec); extern int process_file(struct config *conf, char *conf_file); extern struct keyword * find_keyword(vector keywords, vector v, char * name); |