]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Don't try to use systemd-ask-password if it is not available
authorDavid Sommerseth <davids@redhat.com>
Tue, 9 Sep 2014 16:58:53 +0000 (18:58 +0200)
committerDavid Sommerseth <davids@redhat.com>
Wed, 10 Sep 2014 09:55:35 +0000 (11:55 +0200)
If the SYSTEMD_ASK_PASSWORD_PATH executable cannot be found, we
don't consider systemd as running.

[v2 - Don't clean up white-space]

Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: 20140909202044.GJ1118@greenie.muc.de
URL: http://article.gmane.org/gmane.network.openvpn.devel/9035

src/openvpn/console.c

index 059b6f0bac5b661bb489ddf900b2d442e300512d..337b1bbc54e66ec3d345471f622f7a98a51fc7aa 100644 (file)
@@ -143,14 +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);
+         && (a.st_dev != b.st_dev)
+         && (stat(SYSTEMD_ASK_PASSWORD_PATH, &c) == 0);
 
 }