summaryrefslogtreecommitdiff
path: root/libc/stdio/fdopen.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-02-15 05:45:24 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-02-15 05:45:24 +0000
commit3c71e47750ea70d3dfa46490b28740eccf711956 (patch)
tree9ab93c745fb98ff2fa87bae1abcdb1e908ee04b4 /libc/stdio/fdopen.c
parent44d44d807ede85c53e05d88df82036b23c23e4a9 (diff)
suppress bogus ioctl on fd==INT_MAX when vasprintf() is called
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)