aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sommerseth2014-09-05 14:26:32 +0200
committerDavid Sommerseth2014-10-16 17:07:54 +0200
commitf54cdc9f5316906c664a782abf8fdac028a80860 (patch)
tree516f04e39664ebcecbb11d67d7595ea92b674cbb
parentef21281b290c2984523c36be06f62b24ca253001 (diff)
downloadopenvpn-f54cdc9f5316906c664a782abf8fdac028a80860.zip
openvpn-f54cdc9f5316906c664a782abf8fdac028a80860.tar.gz
Don't let openvpn_popen() keep zombies around
Commit 9449e6a9eba30c9ed054f57d630a88c9f087080f introduced the openvpn_popen() function to support retrieving passwords via systemd. It was discovered that the child processes openvpn fork()ed would be lingering around until openvpn stopped. This was due to the lack of a wait() call. This patch also cleans up a few minor white-space issues in the same code segment. [v2 proper initialisation of status variable] Signed-off-by: David Sommerseth <davids@redhat.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: 1409930731-15263-2-git-send-email-davids@redhat.com URL: http://article.gmane.org/gmane.network.openvpn.devel/9021 (cherry picked from commit d886d468849051af525bb8ff1b9080f6c934e3ab)
-rw-r--r--src/openvpn/misc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index a2bd2cc..8408438 100644
--- a/src/openvpn/misc.c
+++ b/src/openvpn/misc.c
@@ -376,8 +376,11 @@ openvpn_popen (const struct argv *a, const struct env_set *es)
}
else /* parent side */
{
- ret=pipe_stdout[0];
- close (pipe_stdout[1]);
+ int status = 0;
+
+ waitpid(pid, &status, 0);
+ ret = pipe_stdout[0];
+ close (pipe_stdout[1]);
}
}
else {