summaryrefslogtreecommitdiff
path: root/libc/stdio/fdopen.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdio/fdopen.c')
-rw-r--r--libc/stdio/fdopen.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libc/stdio/fdopen.c b/libc/stdio/fdopen.c
index d47d6ea99..85ece2a5f 100644
--- a/libc/stdio/fdopen.c
+++ b/libc/stdio/fdopen.c
@@ -14,8 +14,9 @@ FILE *fdopen(int filedes, const char *mode)
{
intptr_t cur_mode;
- return (((cur_mode = fcntl(filedes, F_GETFL))) != -1)
- ? _stdio_fopen(cur_mode, mode, NULL, filedes)
- : NULL;
+ cur_mode = fcntl(filedes, F_GETFL);
+ if (cur_mode != -1)
+ return _stdio_fopen(cur_mode, mode, NULL, filedes);
+ return NULL;
}
libc_hidden_def(fdopen)