Attention is currently required from: flichtenheld.

Hello flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/767?usp=email

to review the following change.


Change subject: WIP print child exit code
......................................................................

WIP print child exit code

Change-Id: I188923efc0f72b2038f1470740415ce50d07580b
Signed-off-by: Arne Schwabe <a...@rfc2549.org>
---
M src/openvpn/tun_afunix.c
1 file changed, 30 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/67/767/1

diff --git a/src/openvpn/tun_afunix.c b/src/openvpn/tun_afunix.c
index a2d8552..e26e1d8 100644
--- a/src/openvpn/tun_afunix.c
+++ b/src/openvpn/tun_afunix.c
@@ -48,6 +48,31 @@
 #include <stdlib.h>

 static void
+child_handler(int sig)
+{
+    int status;
+    pid_t pid;
+
+    /* EEEEXTEERMINAAATE! */
+    while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
+    {
+        msg(M_INFO, "Child process PID %d died with status code %d", pid, 
status);
+    }
+}
+
+static void
+enable_signal_handler(void)
+{
+    /* Establish handler. */
+    struct sigaction sa;
+    sigemptyset(&sa.sa_mask);
+    sa.sa_flags = 0;
+    sa.sa_handler = child_handler;
+
+    sigaction(SIGCHLD, &sa, NULL);
+}
+
+static void
 tun_afunix_exec_child(const char *dev_node, struct tuntap *tt, struct env_set 
*env)
 {
     struct argv argv = argv_new();
@@ -59,10 +84,13 @@
     argv_printf(&argv, "%s", program);

     argv_msg(M_INFO, &argv);
+
+    enable_signal_handler();
     tt->afunix.childprocess = openvpn_execve_check(&argv, env, S_NOWAITPID,
                                                    "ERROR: failure executing "
                                                    "process for tun");
     argv_free(&argv);
+
 }

 void
@@ -120,6 +148,8 @@
     gc_free(&gc);
 }

+
+
 void
 close_tun_afunix(struct tuntap *tt)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/767?usp=email
To unsubscribe, or for help writing mail filters, visit 
http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I188923efc0f72b2038f1470740415ce50d07580b
Gerrit-Change-Number: 767
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <arne-open...@rfc2549.org>
Gerrit-Reviewer: flichtenheld <fr...@lichtenheld.com>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-Attention: flichtenheld <fr...@lichtenheld.com>
Gerrit-MessageType: newchange
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to