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/nspawn | |
parent | 7f610dee511a971a8b1932625ab33c5852915bc1 (diff) | |
parent | 6cbe4ed1e11fd2916f9dde39b27c70ffa6ba01d9 (diff) |
Merge pull request #1700 from ssahani/word
Port to extract_first_word
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 8140cda141..44f08ab1b4 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -387,6 +387,7 @@ static int parse_argv(int argc, char *argv[]) { }; int c, r; + const char *p; uint64_t plus = 0, minus = 0; bool mask_all_settings = false, mask_no_settings = false; @@ -524,15 +525,16 @@ static int parse_argv(int argc, char *argv[]) { case ARG_CAPABILITY: case ARG_DROP_CAPABILITY: { - const char *state, *word; - size_t length; + p = optarg; + for(;;) { + _cleanup_free_ char *t = NULL; - FOREACH_WORD_SEPARATOR(word, length, optarg, ",", state) { - _cleanup_free_ char *t; + r = extract_first_word(&p, &t, ",", 0); + if (r < 0) + return log_error_errno(r, "Failed to parse capability %s.", t); - t = strndup(word, length); - if (!t) - return log_oom(); + if (r == 0) + break; if (streq(t, "all")) { if (c == ARG_CAPABILITY) |