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

MiNT 1.09: Bug in Fselect



Fselect does not work correctly if identical pointers gets passed,
for example:

int fds = 1;
Fselect (0, &fds, &fds, 0);

fds is cleared before it is read the second time (via *wfdp).

Of course, this is not very usefull, but configure from the screen
package depends on it.

--- orig/dosfile.c	Mon Aug  2 19:00:44 1993
+++ dosfile.c	Sat Dec  4 17:32:46 1993
@@ -965,19 +965,21 @@
 	TIMEOUT *t;
 	short sr;
 
-	if (xfdp)
-		*xfdp = 0;
-
 	if (rfdp) {
-		rfd = *rfdp; *rfdp = 0;
+		rfd = *rfdp;
 	}
 	else
 		rfd = 0;
 	if (wfdp) {
-		wfd = *wfdp; *wfdp = 0;
+		wfd = *wfdp;
 	}
 	else
 		wfd = 0;
+
+	/* Watch out for aliasing */
+	if (rfdp) *rfdp = 0;
+	if (wfdp) *wfdp = 0;
+	if (xfdp) *xfdp = 0;
 
 	TRACE(("Fselect(%u, %lx, %lx)", timeout, rfd, wfd));
 	p = curproc;			/* help the optimizer out */