From f014d825983d55ade9a6edf2cf46c4b20b636234 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/libelogind/sd-login/sd-login.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libelogind/sd-login/sd-login.c b/src/libelogind/sd-login/sd-login.c index 794136304..96d7e447a 100644 --- a/src/libelogind/sd-login/sd-login.c +++ b/src/libelogind/sd-login/sd-login.c @@ -910,6 +910,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.30.2