diff options
Diffstat (limited to 'libc/stdio')
-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); } } } |