From 33f4167282dc5b9716a23b9d957b955f220370d2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 19 Aug 2022 20:04:49 +0100 Subject: [PATCH] prefork-interp: wip socketry etc. Signed-off-by: Ian Jackson --- cprogs/prefork-interp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cprogs/prefork-interp.c b/cprogs/prefork-interp.c index 1125601..ec43bcf 100644 --- a/cprogs/prefork-interp.c +++ b/cprogs/prefork-interp.c @@ -404,7 +404,7 @@ void become_watcher(void) { uv_fs_event_t uvhandle_sockpath; int r; - if (fcntl(0, F_SETFL, O_NONBLOCK)) diee("watcher set stdin nonblocking"); + nonblock(0); errno= -uv_loop_init(&loop); if (errno) diee("watcher: uv_loop_init"); @@ -448,6 +448,8 @@ void become_setup(int sfd, int fake_pair[2], if (dup2(null_0, 0)) diee("dup2 /dev/null onto stdin"); if (dup2(2, 1) != 1) die("dup2 stderr onto stdout"); + nonblock(sfd); + // Extension could work like this: // // We advertise a new protocol (perhaps one which is nearly entirely @@ -518,8 +520,7 @@ static void connect_or_spawn(void) { close(watcher_stdin[0]); close(watcher_stderr[1]); - if (fcntl(watcher_stderr[0], F_SETFL, O_NONBLOCK)) - diee("parent set watcher stderr nonblocking"); + nonblock(watcher_stderr[0]); // Fork setup -- 2.30.2