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/journal-remote/journal-remote.c | |
parent | 7f610dee511a971a8b1932625ab33c5852915bc1 (diff) | |
parent | 6cbe4ed1e11fd2916f9dde39b27c70ffa6ba01d9 (diff) |
Merge pull request #1700 from ssahani/word
Port to extract_first_word
Diffstat (limited to 'src/journal-remote/journal-remote.c')
-rw-r--r-- | src/journal-remote/journal-remote.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index a2c49b8b4d..44550532b6 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -1255,6 +1255,7 @@ static int parse_argv(int argc, char *argv[]) { }; int c, r; + const char *p; bool type_a, type_b; assert(argc >= 0); @@ -1415,18 +1416,21 @@ static int parse_argv(int argc, char *argv[]) { case ARG_GNUTLS_LOG: { #ifdef HAVE_GNUTLS - const char *word, *state; - size_t size; + p = optarg; + for (;;) { + _cleanup_free_ char *word = NULL; - FOREACH_WORD_SEPARATOR(word, size, optarg, ",", state) { - char *cat; + r = extract_first_word(&p, &word, ",", 0); + if (r < 0) + return log_error_errno(r, "Failed to parse --gnutls-log= argument: %m"); - cat = strndup(word, size); - if (!cat) - return log_oom(); + if (r == 0) + break; - if (strv_consume(&arg_gnutls_log, cat) < 0) + if (strv_push(&arg_gnutls_log, word) < 0) return log_oom(); + + word = NULL; } break; #else |