coredump: Don't log an error if D-Bus isn't running
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 6 Oct 2021 12:20:36 +0000 (13:20 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 12 Oct 2021 15:19:36 +0000 (17:19 +0200)
coredumpctl could be used in a chroot where D-Bus isn't running. If
that's the case, we shouldn't consider it an error if we can't connect
to the D-Bus daemon so let's reduce the severity of the error we log
when we can't connect to D-Bus because the socket doesn't exist.

(cherry picked from commit 414bd2e786f9912f51b82e5fe4a1126179a5652a)

src/coredump/coredumpctl.c

index def3650bb4588107bba8aea3912660f473dac955..3d44e51e32b89eb75065250b7967d0c222e98fa8 100644 (file)
@@ -1186,6 +1186,10 @@ static int check_units_active(void) {
                 return false;
 
         r = sd_bus_default_system(&bus);
+        if (r == -ENOENT) {
+                log_debug("D-Bus is not running, skipping active unit check");
+                return 0;
+        }
         if (r < 0)
                 return log_error_errno(r, "Failed to acquire bus: %m");