chiark / gitweb /
basic/log: use IN_SET
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 18 Dec 2016 00:55:43 +0000 (19:55 -0500)
committerSven Eden <yamakuzure@gmx.net>
Mon, 17 Jul 2017 15:58:35 +0000 (17:58 +0200)
src/basic/log.c

index 6b3516b418f1567c5d08b8aaa9477e87797eaee6..6bbaeffaddd00808cc6294764cf9811f08ea97c7 100644 (file)
@@ -999,30 +999,24 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
         if (streq(key, "debug") && !value)
                 log_set_max_level(LOG_DEBUG);
 
-        else if (proc_cmdline_key_streq(key, "systemd.log_target")) {
-
-                if (proc_cmdline_value_missing(key, value))
-                        return 0;
+        else if (streq(key, "systemd.log_target") && value) {
 
                 if (log_set_target_from_string(value) < 0)
                         log_warning("Failed to parse log target '%s'. Ignoring.", value);
 
-        } else if (proc_cmdline_key_streq(key, "systemd.log_level")) {
-
-                if (proc_cmdline_value_missing(key, value))
-                        return 0;
+        } else if (streq(key, "systemd.log_level") && value) {
 
                 if (log_set_max_level_from_string(value) < 0)
                         log_warning("Failed to parse log level '%s'. Ignoring.", value);
 
-        } else if (proc_cmdline_key_streq(key, "systemd.log_color")) {
+        } else if (streq(key, "systemd.log_color") && value) {
 
-                if (log_show_color_from_string(value ?: "1") < 0)
+                if (log_show_color_from_string(value) < 0)
                         log_warning("Failed to parse log color setting '%s'. Ignoring.", value);
 
-        } else if (proc_cmdline_key_streq(key, "systemd.log_location")) {
+        } else if (streq(key, "systemd.log_location") && value) {
 
-                if (log_show_location_from_string(value ?: "1") < 0)
+                if (log_show_location_from_string(value) < 0)
                         log_warning("Failed to parse log location setting '%s'. Ignoring.", value);
         }
 
@@ -1033,9 +1027,10 @@ void log_parse_environment(void) {
         const char *e;
 
         if (get_ctty_devnr(0, NULL) < 0)
-                /* Only try to read the command line in daemons.  We assume that anything that has a controlling tty is
-                   user stuff. */
-                (void) proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_STRIP_RD_PREFIX);
+                /* Only try to read the command line in daemons.
+                   We assume that anything that has a controlling
+                   tty is user stuff. */
+                (void) parse_proc_cmdline(parse_proc_cmdline_item, NULL, true);
 
         e = secure_getenv("SYSTEMD_LOG_TARGET");
         if (e && log_set_target_from_string(e) < 0)