From 3fe1519ec24bf096c8389fa66352d97d7d269e12 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 17 Dec 2016 19:55:43 -0500 Subject: [PATCH] basic/log: use IN_SET --- src/basic/log.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/basic/log.c b/src/basic/log.c index 6b3516b41..6bbaeffad 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -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) -- 2.30.2