From 0cbb768abad835e940359d54312811732507be68 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 11 Feb 2021 03:27:22 +0900 Subject: conf-parser: use return codes in xxx_from_string() Follow-up for #11484. --- src/shared/conf-parser.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/shared/conf-parser.h') diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h index 283d60a473..5a7dc7ff59 100644 --- a/src/shared/conf-parser.h +++ b/src/shared/conf-parser.h @@ -207,7 +207,7 @@ typedef enum Disabled { \ x = from_string(rvalue); \ if (x < 0) { \ - log_syntax(unit, LOG_WARNING, filename, line, 0, \ + log_syntax(unit, LOG_WARNING, filename, line, x, \ msg ", ignoring: %s", rvalue); \ return 0; \ } \ @@ -235,7 +235,7 @@ typedef enum Disabled { \ x = name##_from_string(rvalue); \ if (x < 0) { \ - log_syntax(unit, LOG_WARNING, filename, line, 0, \ + log_syntax(unit, LOG_WARNING, filename, line, x, \ msg ", ignoring: %s", rvalue); \ return 0; \ } \ @@ -269,14 +269,17 @@ typedef enum Disabled { r = extract_first_word(&p, &en, NULL, 0); \ if (r == -ENOMEM) \ return log_oom(); \ - if (r < 0) \ - return log_syntax(unit, LOG_ERR, filename, line, 0, \ - msg ": %s", en); \ + if (r < 0) { \ + log_syntax(unit, LOG_WARNING, filename, line, r, \ + msg ", ignoring: %s", en); \ + return 0; \ + } \ if (r == 0) \ break; \ \ - if ((x = name##_from_string(en)) < 0) { \ - log_syntax(unit, LOG_WARNING, filename, line, 0, \ + x = name##_from_string(en); \ + if (x < 0) { \ + log_syntax(unit, LOG_WARNING, filename, line, x, \ msg ", ignoring: %s", en); \ continue; \ } \ -- cgit v1.2.1