diff options
author | Susant Sahani <ssahani@gmail.com> | 2015-10-26 15:28:03 +0530 |
---|---|---|
committer | Susant Sahani <ssahani@gmail.com> | 2015-10-26 15:32:08 +0530 |
commit | d581d9d91fa5c42ce7828a7d0b1334d370cf1670 (patch) | |
tree | 8d0be89d84f251c373a8b3b783b7d26d68b667de /src/journal/journald-server.c | |
parent | 931c7feac07aa0f8c1be02b4f746a568c9cae883 (diff) |
journald-server: port to extract_first_word
Diffstat (limited to 'src/journal/journald-server.c')
-rw-r--r-- | src/journal/journald-server.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 140d40667e..0ef1a7da83 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -1287,8 +1287,7 @@ static int setup_signals(Server *s) { static int server_parse_proc_cmdline(Server *s) { _cleanup_free_ char *line = NULL; - const char *w, *state; - size_t l; + const char *p; int r; r = proc_cmdline(&line); @@ -1297,12 +1296,16 @@ static int server_parse_proc_cmdline(Server *s) { return 0; } - FOREACH_WORD_QUOTED(w, l, line, state) { + p = line; + for(;;) { _cleanup_free_ char *word; - word = strndup(w, l); - if (!word) - return -ENOMEM; + r = extract_first_word(&p, &word, NULL, 0); + if (r < 0) + return log_error_errno(r, "Failed to parse journald syntax \"%s\": %m", line); + + if (r == 0) + break; if (startswith(word, "systemd.journald.forward_to_syslog=")) { r = parse_boolean(word + 35); |