Skip to contentSkip to conversation

Don't let openvpn_popen() keep zoombies around

PATCH In review [email protected]... 2 participants 2 messages Sep 3, 2014 – Sep 4, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't let openvpn_popen() keep zoombies around

From: David Sommerseth <[email protected]...>

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.

---
 src/openvpn/misc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
src/openvpn/misc.c +5 -2
index 63b4c1c..16c8dcf 100644
@@ -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;
+
+                          waitpid(pid, &status, 0);
+                          ret = pipe_stdout[0];
+                          close (pipe_stdout[1]);
 			}
 	      }
 	      else {
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 9 lines · On 03/09/14 18:23, [email protected]... wrote:

From: David Sommerseth <[email protected]...>

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.

Quoted 5 lines

This patch also cleans up a few minor white-space issues in the same code segment.

I've received some feedback privately on this patch. I will post a new one in the following days, fixing up a minor thing and some other aspects too.

Signature · 3 lines
kind regards,

David Sommerseth