[Midnightbsd-cvs] src: uthread_close.c: Merge changes.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Oct 30 17:22:08 EDT 2008


Log Message:
-----------
Merge changes.

Modified Files:
--------------
    src/lib/libc_r/uthread:
        uthread_close.c (r1.3 -> r1.4)

-------------- next part --------------
Index: uthread_close.c
===================================================================
RCS file: /home/cvs/src/lib/libc_r/uthread/uthread_close.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -L lib/libc_r/uthread/uthread_close.c -L lib/libc_r/uthread/uthread_close.c -u -r1.3 -r1.4
--- lib/libc_r/uthread/uthread_close.c
+++ lib/libc_r/uthread/uthread_close.c
@@ -10,10 +10,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
+ * 3. Neither the name of the author nor the names of any co-contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -29,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libc_r/uthread/uthread_close.c,v 1.16 2003/06/09 16:45:37 netchild Exp $
+ * $FreeBSD: src/lib/libc_r/uthread/uthread_close.c,v 1.17 2007/01/12 07:25:25 imp Exp $
  */
 #include <errno.h>
 #include <stdlib.h>
@@ -63,7 +60,8 @@
 	 * Lock the file descriptor while the file is closed and get
 	 * the file descriptor status:
 	 */
-	else if ((ret = _FD_LOCK(fd, FD_RDWR, NULL)) == 0) {
+	else if (((ret = _FD_LOCK(fd, FD_RDWR, NULL)) == 0) &&
+	    ((ret = __sys_fstat(fd, &sb)) == 0)) {
 		/*
 		 * Check if the file should be left as blocking.
 		 *
@@ -84,8 +82,7 @@
 		 * using, which would then cause any reads to block
 		 * indefinitely.
 		 */
-		if (__sys_fstat(fd, &sb) == 0 &&
-		    (S_ISREG(sb.st_mode) || S_ISCHR(sb.st_mode))
+		if ((S_ISREG(sb.st_mode) || S_ISCHR(sb.st_mode))
 		    && (_thread_fd_getflags(fd) & O_NONBLOCK) == 0) {
 			/* Get the current flags: */
 			flags = __sys_fcntl(fd, F_GETFL, NULL);


More information about the Midnightbsd-cvs mailing list