summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixChan.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-10-12 15:20:40 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-10-12 15:20:40 (GMT)
commit830088187a0558fe12fec8d7691a3d4cfa030ebb (patch)
treedbf55a30b53458116aca5310fd66520442766a68 /unix/tclUnixChan.c
parentaf0441257350948ae892cc9c2dc798eea0a62d2c (diff)
parente6a868c242fb7ad99bf71d9d57597761e1fec9ab (diff)
downloadtcl-830088187a0558fe12fec8d7691a3d4cfa030ebb.zip
tcl-830088187a0558fe12fec8d7691a3d4cfa030ebb.tar.gz
tcl-830088187a0558fe12fec8d7691a3d4cfa030ebb.tar.bz2
Merge 8.7
Diffstat (limited to 'unix/tclUnixChan.c')
-rw-r--r--unix/tclUnixChan.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 8785ff7..696d938 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -286,7 +286,7 @@ FileInputProc(
*/
do {
- bytesRead = read(fsPtr->fd, buf, (size_t)toRead);
+ bytesRead = read(fsPtr->fd, buf, toRead);
} while ((bytesRead < 0) && (errno == EINTR));
if (bytesRead < 0) {
@@ -335,7 +335,7 @@ FileOutputProc(
return 0;
}
- written = write(fsPtr->fd, buf, (size_t)toWrite);
+ written = write(fsPtr->fd, buf, toWrite);
if (written >= 0) {
return written;
}
@@ -549,6 +549,20 @@ FileWideSeekProc(
*----------------------------------------------------------------------
*/
+/*
+ * Bug ad5a57f2f271: Tcl_NotifyChannel is not a Tcl_FileProc,
+ * so do not pass it to directly to Tcl_CreateFileHandler.
+ * Instead, pass a wrapper which is a Tcl_FileProc.
+ */
+static void
+FileWatchNotifyChannelWrapper(
+ void *clientData,
+ int mask)
+{
+ Tcl_Channel channel = (Tcl_Channel)clientData;
+ Tcl_NotifyChannel(channel, mask);
+}
+
static void
FileWatchProc(
void *instanceData, /* The file state. */
@@ -559,15 +573,13 @@ FileWatchProc(
FileState *fsPtr = (FileState *)instanceData;
/*
- * Make sure we only register for events that are valid on this file. Note
- * that we are passing Tcl_NotifyChannel directly to Tcl_CreateFileHandler
- * with the channel pointer as the client data.
+ * Make sure we only register for events that are valid on this file.
*/
mask &= fsPtr->validMask;
if (mask) {
Tcl_CreateFileHandler(fsPtr->fd, mask,
- (Tcl_FileProc *) Tcl_NotifyChannel, fsPtr->channel);
+ FileWatchNotifyChannelWrapper, fsPtr->channel);
} else {
Tcl_DeleteFileHandler(fsPtr->fd);
}