]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix a couple of issues in openvpn_execve()
authorDavid Sommerseth <davids@redhat.com>
Mon, 9 Jan 2012 17:07:28 +0000 (18:07 +0100)
committerDavid Sommerseth <davids@redhat.com>
Tue, 10 Jan 2012 13:22:10 +0000 (14:22 +0100)
If openvpn_execve() is not able to fork(), it would not make any noise
about it.  So this patch adds a log notification if this happens.

In addition, if openvpn_execve() is called with an empty argv array,
it should exit instantly.  This is not expected to happen at all and
might indicate a much more serious issue (or programming error)
somewhere else in the code.  Thus, abort execution to get these issues
flushed out as quickly as possible.

Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
misc.c

diff --git a/misc.c b/misc.c
index 9ac28776e5e466bcc91194598c0f19cfbd101795..b834a3e4e5cc23d428ed41138ddbb4cb14af704a 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -529,7 +529,7 @@ openvpn_execve (const struct argv *a, const struct env_set *es, const unsigned i
                  exit (127);
                }
              else if (pid < (pid_t)0) /* fork failed */
-               ;
+               msg (M_ERR, "openvpn_execve: unable to fork");
              else /* parent side */
                {
                  if (waitpid (pid, &ret, 0) != pid)
@@ -556,7 +556,7 @@ openvpn_execve (const struct argv *a, const struct env_set *es, const unsigned i
     }
   else
     {
-      msg (M_WARN, "openvpn_execve: called with empty argv");
+      msg (M_FATAL, "openvpn_execve: called with empty argv");
     }
 
   gc_free (&gc);