]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coredumpctl: Don't treat no coredumps as failure
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 23 Nov 2024 11:14:06 +0000 (12:14 +0100)
committerMike Yuan <me@yhndnzj.com>
Tue, 10 Dec 2024 20:03:20 +0000 (21:03 +0100)
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
src/coredump/coredumpctl.c

index 6179d6b760d95e69d6ed4e95641dcdd07d00227e..6db9bca0681a24d1298fc8870e4e2cce09fc415e 100644 (file)
 
   <refsect1>
     <title>Exit status</title>
-    <para>On success, 0 is returned; otherwise, a non-zero failure
-    code is returned. Not finding any matching core dumps is treated as
-    failure.
-    </para>
+    <para>On success, 0 is returned; otherwise, a non-zero failure code is returned.</para>
   </refsect1>
 
   <refsect1>
index e7d0dd34c0d104d88f8db615c1ce41af41dd750a..4a25a2fb703a1f78316bd677e66fcdd4adb9e41e 100644 (file)
@@ -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;
                 }
         }