From 0543105b0fb13e4243b71a78f62f81fb9dde5d51 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 19 May 2017 07:52:00 -0400 Subject: [PATCH] sd-login: fix querying machines when machined is not running We should not leak the internal error from missing directory and treat that case the same as no machines. --- src/libsystemd/sd-login/sd-login.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c index 82a94bf..25dff77 100644 --- a/src/libsystemd/sd-login/sd-login.c +++ b/src/libsystemd/sd-login/sd-login.c @@ -854,6 +854,10 @@ _public_ int sd_get_machine_names(char ***machines) { assert_return(machines, -EINVAL); r = get_files_in_directory("/run/systemd/machines/", &l); + if (r == -ENOENT) { + *machines = NULL; + return 0; + } if (r < 0) return r; -- 2.7.4