kern/56274: pthreads does not return correct value at EOT
Dan Langille
dan at langille.org
Mon Sep 29 03:20:18 PDT 2003
The following reply was made to PR kern/56274; it has been noted by GNATS.
From: "Dan Langille" <dan at langille.org>
To: FreeBSD-gnats-submit at FreeBSD.org
Cc:
Subject: Re: kern/56274: pthreads does not return correct value at EOT
Date: Mon, 29 Sep 2003 06:12:09 -0400
This patch passes all our testing.
--- uthread_write.c.org Tue Sep 16 12:14:22 2003
+++ uthread_write.c Mon Sep 29 06:05:35 2003
@@ -93,7 +93,7 @@
* write:
*/
if (blocking && ((n < 0 && (errno == EWOULDBLOCK ||
- errno == EAGAIN)) || (n >= 0 && num < nbytes))) {
+ errno == EAGAIN)) || (n > 0 && num < nbytes))) {
curthread->data.fd.fd = fd;
_thread_kern_set_timeout(NULL);
@@ -131,11 +131,15 @@
* If there was an error, return partial success
* (if any bytes were written) or else the error:
*/
- } else if (n < 0) {
+ } else if (n <= 0) {
if (num > 0)
ret = num;
else
ret = n;
+
+ if (n == 0) {
+ break;
+ }
/* Check if the write has completed: */
} else if (num >= nbytes)
--
Dan Langille : http://www.langille.org/
More information about the freebsd-bugs
mailing list