summaryrefslogtreecommitdiffstats
path: root/lib/libc_r/uthread
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>2002-02-22 04:26:54 +0000
committerjb <jb@FreeBSD.org>2002-02-22 04:26:54 +0000
commitde6d708bd1c33997202de8fe4c96e1a92917f1b8 (patch)
treeccdf66debffb874e50da553fe7dc0652ab34d738 /lib/libc_r/uthread
parent6ae47c1bef8362d817116c7376af5dac2261c399 (diff)
downloadFreeBSD-src-de6d708bd1c33997202de8fe4c96e1a92917f1b8.zip
FreeBSD-src-de6d708bd1c33997202de8fe4c96e1a92917f1b8.tar.gz
Fix a bug where a short write to a non-blocking socket would
leave the descriptor locked, causing other threads to hang if they happened to access the socket. MFC after: 5 days
Diffstat (limited to 'lib/libc_r/uthread')
-rw-r--r--lib/libc_r/uthread/uthread_sendfile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc_r/uthread/uthread_sendfile.c b/lib/libc_r/uthread/uthread_sendfile.c
index 901d523..81dcf63 100644
--- a/lib/libc_r/uthread/uthread_sendfile.c
+++ b/lib/libc_r/uthread/uthread_sendfile.c
@@ -139,8 +139,11 @@ _sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr,
/*
* If we're not blocking then return.
*/
- if (!blocking)
+ if (!blocking) {
+ _FD_UNLOCK(s, FD_WRITE);
+ _FD_UNLOCK(fd, FD_READ);
goto SHORT_WRITE;
+ }
/*
* Otherwise wait on the fd.
OpenPOWER on IntegriCloud