summaryrefslogtreecommitdiff
path: root/lib/libpthread/uthread/uthread_write.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libpthread/uthread/uthread_write.c')
-rw-r--r--lib/libpthread/uthread/uthread_write.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libpthread/uthread/uthread_write.c b/lib/libpthread/uthread/uthread_write.c
index 71581d05387..2c4ed1076ff 100644
--- a/lib/libpthread/uthread/uthread_write.c
+++ b/lib/libpthread/uthread/uthread_write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_write.c,v 1.11 2006/09/22 19:04:33 kurt Exp $ */
+/* $OpenBSD: uthread_write.c,v 1.12 2006/10/03 02:59:36 kurt Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
* All rights reserved.
@@ -105,6 +105,7 @@ write(int fd, const void *buf, size_t nbytes)
/* Reset the interrupted operation flag: */
curthread->interrupted = 0;
+ curthread->closing_fd = 0;
_thread_kern_sched_state(PS_FDW_WAIT,
__FILE__, __LINE__);
@@ -113,13 +114,16 @@ write(int fd, const void *buf, size_t nbytes)
* Check if the operation was
* interrupted by a signal
*/
- if (curthread->interrupted) {
+ if (curthread->interrupted || curthread->closing_fd) {
if (num > 0) {
/* Return partial success: */
ret = num;
} else {
/* Return an error: */
- errno = EINTR;
+ if (curthread->closing_fd)
+ errno = EBADF;
+ else
+ errno = EINTR;
ret = -1;
}
}