changeset 12602:cee34dc4a570

6714700 logic error in strdoioctl
author Anil udupa <anil.udupa@sun.com>
date Thu, 10 Jun 2010 13:30:18 -0700
parents 3fd4339427c7
children 4f17200860f5
files usr/src/uts/common/os/streamio.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/os/streamio.c	Thu Jun 10 13:05:14 2010 -0700
+++ b/usr/src/uts/common/os/streamio.c	Thu Jun 10 13:30:18 2010 -0700
@@ -23,8 +23,7 @@
 
 
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #include <sys/types.h>
@@ -5892,6 +5891,7 @@
 	int sigflag = (flag & STR_NOSIG);
 	int errs;
 	uint_t waitflags;
+	boolean_t set_iocwaitne = B_FALSE;
 
 	ASSERT(copyflag == U_TO_K || copyflag == K_TO_K);
 	ASSERT((fflags & FMODELS) != 0);
@@ -5977,7 +5977,8 @@
 
 	error = 0;
 	mutex_enter(&stp->sd_lock);
-	while (stp->sd_flag & (IOCWAIT | IOCWAITNE)) {
+	while ((stp->sd_flag & IOCWAIT) ||
+	    (!set_iocwaitne && (stp->sd_flag & IOCWAITNE))) {
 		clock_t cv_rval;
 
 		TRACE_0(TR_FAC_STREAMS_FR,
@@ -5997,6 +5998,7 @@
 					 * operation completes.
 					 */
 					if (!(stp->sd_flag & IOCWAITNE)) {
+						set_iocwaitne = B_TRUE;
 						stp->sd_flag |= IOCWAITNE;
 						cv_broadcast(&stp->sd_monitor);
 					}