summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2006-11-28 16:29:47 (GMT)
committerKevin B Kenny <kennykb@acm.org>2006-11-28 16:29:47 (GMT)
commit843309598b91d7d115dbac1304072c22dd5b51ea (patch)
tree2a4153277da51a6fe37fa2b23a1c880874e8872f /unix
parent59639928772425a259adb7a469973c099d775bd3 (diff)
downloadtcl-843309598b91d7d115dbac1304072c22dd5b51ea.zip
tcl-843309598b91d7d115dbac1304072c22dd5b51ea.tar.gz
tcl-843309598b91d7d115dbac1304072c22dd5b51ea.tar.bz2
* unix/tclUnixChan.c (TclUnixWaitForFile):
* tests/event.test (event-14.*): Corrected a bug where TclUnixWaitForFile would present select() with the wrong mask on an LP64 machine if a fd number exceeds 32. Thanks to Jean-Luc Fontaine for reporting and diagnosing [Bug 1602208].
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixChan.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 0d2c046..5c4cb65 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixChan.c,v 1.42.2.9 2006/09/07 08:50:35 vasiljevic Exp $
+ * RCS: @(#) $Id: tclUnixChan.c,v 1.42.2.10 2006/11/28 16:29:48 kennykb Exp $
*/
#include "tclInt.h" /* Internal definitions for Tcl. */
@@ -3185,7 +3185,8 @@ TclUnixWaitForFile(fd, mask, timeout)
{
Tcl_Time abortTime = {0, 0}, now; /* silence gcc 4 warning */
struct timeval blockTime, *timeoutPtr;
- int index, bit, numFound, result = 0;
+ int index, numFound, result = 0;
+ fd_mask bit;
fd_mask readyMasks[3*MASK_SIZE];
/* This array reflects the readable/writable
* conditions that were found to exist by the
@@ -3222,7 +3223,7 @@ TclUnixWaitForFile(fd, mask, timeout)
}
memset((VOID *) readyMasks, 0, 3*MASK_SIZE*sizeof(fd_mask));
index = fd/(NBBY*sizeof(fd_mask));
- bit = 1 << (fd%(NBBY*sizeof(fd_mask)));
+ bit = ((fd_mask) 1) << (fd%(NBBY*sizeof(fd_mask)));
/*
* Loop in a mini-event loop of our own, waiting for either the