exec: close stdout and stderr streams on child signal
authorJo-Philipp Wich <jo@mein.io>
Tue, 8 May 2018 18:43:00 +0000 (20:43 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 8 May 2018 18:47:17 +0000 (20:47 +0200)
This prevents timing out ubus call when the child invokes further detached
childs inheriting stdio descriptors.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
exec.c

diff --git a/exec.c b/exec.c
index 8b2f8d1daede6f9401c12a8e5d59d5a0646a4368..f7bfcb2f5e16f550b03e2521c95c3931277e6b91 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -175,6 +175,12 @@ rpc_exec_process_cb(struct uloop_process *p, int stat)
 
        ustream_poll(&c->opipe.stream);
        ustream_poll(&c->epipe.stream);
+
+       close(c->opipe.fd.fd);
+       close(c->epipe.fd.fd);
+
+       ustream_poll(&c->opipe.stream);
+       ustream_poll(&c->epipe.stream);
 }
 
 static void