diff options
Diffstat (limited to 'lib/libpthread/uthread/uthread_recvmsg.c')
-rw-r--r-- | lib/libpthread/uthread/uthread_recvmsg.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libpthread/uthread/uthread_recvmsg.c b/lib/libpthread/uthread/uthread_recvmsg.c index 4e14aad4549..66de9d14998 100644 --- a/lib/libpthread/uthread/uthread_recvmsg.c +++ b/lib/libpthread/uthread/uthread_recvmsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_recvmsg.c,v 1.9 2009/04/11 20:26:58 jakemsr Exp $ */ +/* $OpenBSD: uthread_recvmsg.c,v 1.10 2010/01/03 23:05:35 fgsch Exp $ */ /* * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -57,9 +57,10 @@ recvmsg(int fd, struct msghdr *msg, int flags) curthread->data.fd.fd = fd; /* Set the timeout: */ - _thread_kern_set_timeout(NULL); + _thread_kern_set_timeout(_FD_RCVTIMEO(fd)); curthread->interrupted = 0; curthread->closing_fd = 0; + curthread->timeout = 0; _thread_kern_sched_state(PS_FDR_WAIT, __FILE__, __LINE__); /* Check if the wait was interrupted: */ @@ -73,6 +74,11 @@ recvmsg(int fd, struct msghdr *msg, int flags) errno = EBADF; ret = -1; break; + } else if (curthread->timeout) { + /* Return an error status: */ + errno = EWOULDBLOCK; + ret = -1; + break; } } else { ret = -1; |