From 4ba08b4526af9a222f409a12aaf45c0aa0beb904 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 25 Feb 2002 15:06:10 +0000 Subject: When messing with fd NONBLOCK status, put things back the way we found them afterwards. As was, this hosed things up for fds shared with a parent process. Very bad for shells... Oops. -Erik --- libc/stdio/stdio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libc/stdio') diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c index 3f475aec0..63fb6bd00 100644 --- a/libc/stdio/stdio.c +++ b/libc/stdio/stdio.c @@ -203,8 +203,11 @@ void __stdio_flush_buffers(void) if (WRITEABLE(fp)) { /* Set the underlying fd to non-block mode to ensure * that calls to _exit() and abort() will not block */ - fcntl(fp->fd, F_SETFL, O_NONBLOCK); + long flags; + fcntl(fp->fd, F_GETFL, &flags); + fcntl(fp->fd, F_SETFL, flags|O_NONBLOCK); fflush(fp); + fcntl(fp->fd, F_SETFL, flags); } } } -- cgit v1.2.3