diff options
author | julian <julian@FreeBSD.org> | 1998-02-05 21:16:52 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1998-02-05 21:16:52 +0000 |
commit | 5b999ea00cf06f4dfbcc8953dd07c062cbc66699 (patch) | |
tree | 2e16e6742347cfb54b158425a4e6ccb3e8e06d01 /lib/libc_r | |
parent | cf8c2edb0ea15a954f953b92615a6bdf5e1070c7 (diff) | |
download | FreeBSD-src-5b999ea00cf06f4dfbcc8953dd07c062cbc66699.zip FreeBSD-src-5b999ea00cf06f4dfbcc8953dd07c062cbc66699.tar.gz |
slight cleanup in handling sockets and file descriptors.
Same fix already applied to other types of fds. This one was apparently missed.
Diffstat (limited to 'lib/libc_r')
-rw-r--r-- | lib/libc_r/uthread/uthread_accept.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/libc_r/uthread/uthread_accept.c b/lib/libc_r/uthread/uthread_accept.c index e240cde..1078bfe 100644 --- a/lib/libc_r/uthread/uthread_accept.c +++ b/lib/libc_r/uthread/uthread_accept.c @@ -76,9 +76,6 @@ accept(int fd, struct sockaddr * name, int *namelen) } } - /* Unlock the file descriptor: */ - _thread_fd_unlock(fd, FD_RDWR); - /* Check for errors: */ if (ret < 0) { } @@ -90,6 +87,19 @@ accept(int fd, struct sockaddr * name, int *namelen) /* Return an error: */ ret = -1; } + /* + * If the parent socket was blocking, make sure that + * the new socket is also set blocking here (as the + * call to _thread_fd_table_init() above will always + * set the new socket flags to non-blocking, as that + * will be the inherited state of the new socket. + */ + if((_thread_fd_table[fd]->flags & O_NONBLOCK) == 0) + _thread_fd_table[ret]->flags &= ~O_NONBLOCK; + + /* Unlock the file descriptor: */ + _thread_fd_unlock(fd, FD_RDWR); + } /* Return the socket file descriptor or -1 on error: */ return (ret); |