]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/journal/journald-server.c
journald-server: port to extract_first_word
[thirdparty/systemd.git] / src / journal / journald-server.c
index 140d40667eb2b4bd463a10a2e228688c95fdb2ba..0ef1a7da83534c6a2dd22a066ee6e992c1fb25d0 100644 (file)
@@ -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);