From: David Sommerseth <dav...@redhat.com>

If the SYSTEMD_ASK_PASSWORD_PATH executable cannot be found, we
don't consider systemd as running.

Also cleaned up some white-space issues here while at it.

Signed-off-by: David Sommerseth <dav...@redhat.com>
---
 src/openvpn/console.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/openvpn/console.c b/src/openvpn/console.c
index 059b6f0..e35b6bd 100644
--- a/src/openvpn/console.c
+++ b/src/openvpn/console.c
@@ -143,15 +143,16 @@ close_tty (FILE *fp)
 static bool
 check_systemd_running ()
 {
-  struct stat a, b;
+  struct stat a, b, c;

   /* We simply test whether the systemd cgroup hierarchy is
-   * mounted */
+   * mounted, as well as the systemd-ask-password executable
+   * being available */

   return (lstat("/sys/fs/cgroup", &a) == 0)
-         && (lstat("/sys/fs/cgroup/systemd", &b) == 0)
-         && (a.st_dev != b.st_dev);
-
+    && (lstat("/sys/fs/cgroup/systemd", &b) == 0)
+    && (stat(SYSTEMD_ASK_PASSWORD_PATH, &c) == 0)
+    && (a.st_dev != b.st_dev);
 }

 static bool
-- 
1.8.3.1


Reply via email to