diff options
author | pooryorick <com.digitalsmarties@pooryorick.com> | 2021-06-17 08:53:04 (GMT) |
---|---|---|
committer | pooryorick <com.digitalsmarties@pooryorick.com> | 2021-06-17 08:53:04 (GMT) |
commit | 597edf50b5c0ad1444212463486c8543f948d0ca (patch) | |
tree | df77b728ddc5863e979810fe42ae4a3b30d54f24 /unix | |
parent | 79b57974dc692ad554c9c4679d4b8dccb5eab963 (diff) | |
download | tcl-597edf50b5c0ad1444212463486c8543f948d0ca.zip tcl-597edf50b5c0ad1444212463486c8543f948d0ca.tar.gz tcl-597edf50b5c0ad1444212463486c8543f948d0ca.tar.bz2 |
Fix for [dcb888ed85adeb86]: epoll, special files, directories, links, epoll_ctl operation not permitted, and abort
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclEpollNotfy.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 23c88b2..287dfe2 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -223,22 +223,29 @@ PlatformEventsControl( if (fstat(filePtr->fd, &fdStat) == -1) { Tcl_Panic("fstat: %s", strerror(errno)); - } else if ((fdStat.st_mode & S_IFMT) == S_IFREG) { - switch (op) { - case EPOLL_CTL_ADD: - if (isNew) { - LIST_INSERT_HEAD(&tsdPtr->firstReadyFileHandlerPtr, filePtr, - readyNode); - } - break; - case EPOLL_CTL_DEL: - LIST_REMOVE(filePtr, readyNode); - break; + } + + if (epoll_ctl(tsdPtr->eventsFd, op, filePtr->fd, &newEvent) == -1) { + switch (errno) { + case EPERM: + switch (op) { + case EPOLL_CTL_ADD: + if (isNew) { + LIST_INSERT_HEAD(&tsdPtr->firstReadyFileHandlerPtr, filePtr, + readyNode); + } + break; + case EPOLL_CTL_DEL: + LIST_REMOVE(filePtr, readyNode); + break; + + } + break; + default: + Tcl_Panic("epoll_ctl: %s", strerror(errno)); } - return; - } else if (epoll_ctl(tsdPtr->eventsFd, op, filePtr->fd, &newEvent) == -1) { - Tcl_Panic("epoll_ctl: %s", strerror(errno)); - } + } + return; } /* |