diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-28 19:32:35 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-28 19:32:35 +0100 |
commit | 2c80779e33e2bea8e335f3c93b144f671d6bc62c (patch) | |
tree | 107f1a5932791aded551730dd6602f2bc8b249ab /src/shared | |
parent | 7f610dee511a971a8b1932625ab33c5852915bc1 (diff) | |
parent | 6cbe4ed1e11fd2916f9dde39b27c70ffa6ba01d9 (diff) |
Merge pull request #1700 from ssahani/word
Port to extract_first_word
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/install.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/shared/install.c b/src/shared/install.c index c74efede76..b7d1d22505 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -929,8 +929,6 @@ static int config_parse_also( void *data, void *userdata) { - size_t l; - const char *word, *state; InstallContext *c = data; UnitFileInstallInfo *i = userdata; @@ -938,13 +936,18 @@ static int config_parse_also( assert(lvalue); assert(rvalue); - FOREACH_WORD_QUOTED(word, l, rvalue, state) { - _cleanup_free_ char *n; + for(;;) { + _cleanup_free_ char *n = NULL; int r; - n = strndup(word, l); - if (!n) - return -ENOMEM; + r = extract_first_word(&rvalue, &n, NULL, 0); + if (r < 0) { + log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse config %s, ignoring.", rvalue); + return 0; + } + + if (r == 0) + break; r = install_info_add(c, n, NULL); if (r < 0) @@ -954,8 +957,6 @@ static int config_parse_also( if (r < 0) return r; } - if (!isempty(state)) - log_syntax(unit, LOG_ERR, filename, line, 0, "Trailing garbage, ignoring."); return 0; } |