diff options
Diffstat (limited to 'lib/libpthread/uthread/uthread_writev.c')
-rw-r--r-- | lib/libpthread/uthread/uthread_writev.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/libpthread/uthread/uthread_writev.c b/lib/libpthread/uthread/uthread_writev.c index 17850b0f875..6c3d41c14f4 100644 --- a/lib/libpthread/uthread/uthread_writev.c +++ b/lib/libpthread/uthread/uthread_writev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_writev.c,v 1.13 2007/05/18 19:28:50 kurt Exp $ */ +/* $OpenBSD: uthread_writev.c,v 1.14 2010/01/03 23:05:35 fgsch Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -175,11 +175,12 @@ writev(int fd, const struct iovec * iov, int iovcnt) if (blocking && ((n < 0 && (errno == EWOULDBLOCK || errno == EAGAIN)) || (n >= 0 && idx < iovcnt))) { curthread->data.fd.fd = fd; - _thread_kern_set_timeout(NULL); + _thread_kern_set_timeout(_FD_SNDTIMEO(fd)); /* Reset the interrupted operation flag: */ curthread->interrupted = 0; curthread->closing_fd = 0; + curthread->timeout = 0; _thread_kern_sched_state(PS_FDW_WAIT, __FILE__, __LINE__); @@ -188,7 +189,9 @@ writev(int fd, const struct iovec * iov, int iovcnt) * Check if the operation was * interrupted by a signal */ - if (curthread->interrupted || curthread->closing_fd) { + if (curthread->interrupted || + curthread->closing_fd || + curthread->timeout) { if (num > 0) { /* Return partial success: */ ret = num; @@ -196,8 +199,10 @@ writev(int fd, const struct iovec * iov, int iovcnt) /* Return an error: */ if (curthread->closing_fd) errno = EBADF; - else + else if (curthread->interrupted) errno = EINTR; + else + errno = EWOULDBLOCK; ret = -1; } } |