[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MiNT 1.10: bug in pipe_close



The processes waiting on a pipe should not be waked up in pipe_close
unless it is the last close for the fileptr.  There is no real state
change on the pipe, thus cancelling the selects on the pipe is wrong.
(The patch is bigger than necessary because of the indentation
change.)

--- orig/pipefs.c	Thu Feb 10 00:08:10 1994
+++ pipefs.c	Sat May 14 01:11:04 1994
@@ -926,22 +926,23 @@
 
 	this = (struct fifo *)f->fc.index;
 
+	if (f->links <= 0) {
+
 /* wake any processes waiting on this pipe */
-	wake(IO_Q, (long)this->inp);
-	if (this->inp->rsel)
-		wakeselect(this->inp->rsel);
-	if (this->inp->wsel)
-		wakeselect(this->inp->wsel);
-
-	if (this->outp) {
-		wake(IO_Q, (long)this->outp);
-		if (this->outp->wsel)
-			wakeselect(this->outp->wsel);
-		if (this->outp->rsel)
-			wakeselect(this->outp->rsel);
-	}
+		wake(IO_Q, (long)this->inp);
+		if (this->inp->rsel)
+			wakeselect(this->inp->rsel);
+		if (this->inp->wsel)
+			wakeselect(this->inp->wsel);
+
+		if (this->outp) {
+			wake(IO_Q, (long)this->outp);
+			if (this->outp->wsel)
+				wakeselect(this->outp->wsel);
+			if (this->outp->rsel)
+				wakeselect(this->outp->rsel);
+		}
 
-	if (f->links <= 0) {
 /* remove the file pointer from the list of open file pointers 
  * of this pipe
  */

-- 
+------------------------------------------------------------------------+
Andreas Schwab                                      "And now for something
schwab@ls5.informatik.uni-dortmund.de                completely different"
* Linux/Atari is coming soon, stay tuned * But don't hold your breath... *