aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-03-26 18:25:57 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-03-26 23:18:31 +0900
commit1a55a676548bb017b85f4a8e34b85e6eef4549f3 (patch)
treef6a11846271f3d58476d0f39c55bd3bfff6fdeb5 /src
parentwin - imf - fix small typo that was not checking the imf ptr... (diff)
downloadterminology-1a55a676548bb017b85f4a8e34b85e6eef4549f3.tar.gz
termpty - set ty_hand to null if returning cancel which dels the fdhand
this avoids later accidentally accessing an invlid hd handler. @fix
Diffstat (limited to 'src')
-rw-r--r--src/bin/termpty.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index a3e5f58..4645d0f 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -232,16 +232,23 @@ _fd_read_do(Termpty *ty, Ecore_Fd_Handler *fd_handler, Eina_Bool false_on_empty)
if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_ERROR))
{
ERR("error while reading from tty slave fd");
+ ty->hand_fd = NULL;
return ECORE_CALLBACK_CANCEL;
}
if (ty->fd == -1)
- return ECORE_CALLBACK_CANCEL;
+ {
+ ty->hand_fd = NULL;
+ return ECORE_CALLBACK_CANCEL;
+ }
/* it seems the BSDs can not read from this side of the pair if the other side
* is closed */
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__)
if (ty->pid == -1)
- return ECORE_CALLBACK_CANCEL;
+ {
+ ty->hand_fd = NULL;
+ return ECORE_CALLBACK_CANCEL;
+ }
#endif
// read up to 64 * 4096 bytes