diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-02-25 15:06:10 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-02-25 15:06:10 +0000 |
commit | 4ba08b4526af9a222f409a12aaf45c0aa0beb904 (patch) | |
tree | 8f16233c596d7694dc631b47ca5f5283ce1829ad /libc | |
parent | 58c542d570047fdbf72deaadeb786d6a5a04bc4d (diff) |
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
Diffstat (limited to 'libc')
-rw-r--r-- | libc/stdio/stdio.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); } } } |