diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-05-08 11:57:28 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2024-05-08 12:43:49 +0200 |
commit | b5636a8f83ec5b181760da7e3ab7cabc4dc4f7f8 (patch) | |
tree | 29b6d1022ff61d51b447cd28ee69bb547a537fcb /src/debug-generator/debug-generator.c | |
parent | ssh-generator: fix pointer cast type (diff) | |
download | systemd-b5636a8f83ec5b181760da7e3ab7cabc4dc4f7f8.tar.xz systemd-b5636a8f83ec5b181760da7e3ab7cabc4dc4f7f8.zip |
debug-generator: enclose function call in if statement when retval
is not used
Diffstat (limited to 'src/debug-generator/debug-generator.c')
-rw-r--r-- | src/debug-generator/debug-generator.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/debug-generator/debug-generator.c b/src/debug-generator/debug-generator.c index 3526b84dee..fdc2afed3a 100644 --- a/src/debug-generator/debug-generator.c +++ b/src/debug-generator/debug-generator.c @@ -49,8 +49,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat if (r < 0) return log_error_errno(r, "Failed to glob unit name: %m"); - r = strv_consume(&arg_mask, n); - if (r < 0) + if (strv_consume(&arg_mask, n) < 0) return log_oom(); } else if (streq(key, "systemd.wants")) { @@ -63,11 +62,11 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat if (r < 0) return log_error_errno(r, "Failed to glob unit name: %m"); - r = strv_consume(&arg_wants, n); - if (r < 0) + if (strv_consume(&arg_wants, n) < 0) return log_oom(); } else if (proc_cmdline_key_streq(key, "systemd.debug_shell")) { + r = value ? parse_boolean(value) : 1; arg_debug_shell = r != 0; if (r >= 0) @@ -76,6 +75,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat return free_and_strdup_warn(&arg_debug_tty, skip_dev_prefix(value)); } else if (proc_cmdline_key_streq(key, "systemd.default_debug_tty")) { + if (proc_cmdline_value_missing(key, value)) return 0; @@ -239,8 +239,7 @@ static int run(const char *dest, const char *dest_early, const char *dest_late) log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); if (arg_debug_shell) { - r = strv_extend(&arg_wants, "debug-shell.service"); - if (r < 0) + if (strv_extend(&arg_wants, "debug-shell.service") < 0) return log_oom(); install_debug_shell_dropin(); |