chiark / gitweb /
sd-login: fix querying machines when machined is not running
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 19 May 2017 11:52:00 +0000 (07:52 -0400)
committerSven Eden <yamakuzure@gmx.net>
Tue, 25 Jul 2017 07:46:52 +0000 (09:46 +0200)
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

index 794136304b7a26ec0e91525e7045e0b909b65251..96d7e447af1118969867d8bc65404becbcc16270 100644 (file)
@@ -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;