diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-02-11 03:27:22 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-02-12 01:17:06 +0900 |
commit | 0cbb768abad835e940359d54312811732507be68 (patch) | |
tree | 683f59020c178ca6a45a98023b46ef2c0131a930 /src/shared/conf-parser.h | |
parent | 1c3c43a4170efdc3ded2a9c469ad7d2a9df1746c (diff) | |
download | systemd-0cbb768abad835e940359d54312811732507be68.tar.gz |
conf-parser: use return codes in xxx_from_string()
Follow-up for #11484.
Diffstat (limited to 'src/shared/conf-parser.h')
-rw-r--r-- | src/shared/conf-parser.h | 17 |
1 files changed, 10 insertions, 7 deletions
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; \ } \ |