Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Sep 2003 03:20:17 -0700 (PDT)
From:      "Dan Langille" <dan@langille.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/56274: pthreads does not return correct value at EOT
Message-ID:  <200309291020.h8TAKH7H009319@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/56274; it has been noted by GNATS.

From: "Dan Langille" <dan@langille.org>
To: FreeBSD-gnats-submit@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/
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309291020.h8TAKH7H009319>