summaryrefslogtreecommitdiff
path: root/lib/libc_r/uthread/uthread_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc_r/uthread/uthread_ioctl.c')
-rw-r--r--lib/libc_r/uthread/uthread_ioctl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libc_r/uthread/uthread_ioctl.c b/lib/libc_r/uthread/uthread_ioctl.c
index 9c7889f97e760..7199372b6e18b 100644
--- a/lib/libc_r/uthread/uthread_ioctl.c
+++ b/lib/libc_r/uthread/uthread_ioctl.c
@@ -43,6 +43,7 @@ int
_ioctl(int fd, unsigned long request,...)
{
int ret;
+ int flags;
int *op;
va_list ap;
@@ -58,8 +59,12 @@ _ioctl(int fd, unsigned long request,...)
* twiddling the flag based on the request
*/
op = va_arg(ap, int *);
- _thread_fd_table[fd]->flags &= ~O_NONBLOCK;
- _thread_fd_table[fd]->flags |= ((*op) ? O_NONBLOCK : 0);
+ flags = _thread_fd_getflags(fd);
+ if (*op == 0)
+ flags &= ~O_NONBLOCK;
+ else
+ flags |= O_NONBLOCK;
+ _thread_fd_setflags(fd, flags);
ret = 0;
break;
default: