From dfe79b9ed21b0feeb5a120e8b994f46cff7cf5b0 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 23 Nov 2024 12:14:06 +0100 Subject: [PATCH] coredumpctl: Don't treat no coredumps as failure Having to deal with a process that fails or doesn't fail depending on whether there are coredumps or not is incredibly annoying for users. --- man/coredumpctl.xml | 5 +---- src/coredump/coredumpctl.c | 5 +++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/man/coredumpctl.xml b/man/coredumpctl.xml index 6179d6b760d..6db9bca0681 100644 --- a/man/coredumpctl.xml +++ b/man/coredumpctl.xml @@ -389,10 +389,7 @@ Exit status - On success, 0 is returned; otherwise, a non-zero failure - code is returned. Not finding any matching core dumps is treated as - failure. - + On success, 0 is returned; otherwise, a non-zero failure code is returned. diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c index e7d0dd34c0d..4a25a2fb703 100644 --- a/src/coredump/coredumpctl.c +++ b/src/coredump/coredumpctl.c @@ -963,9 +963,10 @@ static int dump_list(int argc, char **argv, void *userdata) { } if (!arg_field && n_found <= 0) { - if (!arg_quiet) + if (!arg_quiet && !sd_json_format_enabled(arg_json_format_flags)) log_notice("No coredumps found."); - return -ESRCH; + + return 0; } } -- 2.47.3