From a3c72e6f060bc51cd59b486e8d564489856f3de3 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Fri, 23 Nov 2018 22:13:00 +1000 Subject: aio: Don't use FD_CLOEXEC with JIM_ANSIC Bootstrap jimsh sets JIM_ANSIC but FD_CLOEXEC is enabled. This causes FD_CLOEXEC to be set on fd 0 (stdin), thus closing the default fd 0 in the child process during exec. Signed-off-by: Steve Bennett --- jim-aio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'jim-aio.c') diff --git a/jim-aio.c b/jim-aio.c index 313108b..589dce6 100644 --- a/jim-aio.c +++ b/jim-aio.c @@ -1712,16 +1712,16 @@ static AioFile *JimMakeChannel(Jim_Interp *interp, FILE *fh, int fd, Jim_Obj *fi af = Jim_Alloc(sizeof(*af)); memset(af, 0, sizeof(*af)); af->fp = fh; + af->filename = filename; + af->openFlags = openFlags; #ifndef JIM_ANSIC af->fd = fileno(fh); -#endif - af->filename = filename; #ifdef FD_CLOEXEC if ((openFlags & AIO_KEEPOPEN) == 0) { (void)fcntl(af->fd, F_SETFD, FD_CLOEXEC); } #endif - af->openFlags = openFlags; +#endif af->addr_family = family; af->fops = &stdio_fops; af->ssl = NULL; -- cgit v1.1