raster pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=1a55a676548bb017b85f4a8e34b85e6eef4549f3

commit 1a55a676548bb017b85f4a8e34b85e6eef4549f3
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Mon Mar 26 18:25:57 2018 +0900

    termpty - set ty_hand to null if returning cancel which dels the fdhand
    
    this avoids later accidentally accessing an invlid hd handler.
    
    @fix
---
 src/bin/termpty.c | 11 +++++++++--
 1 file 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

-- 


Reply via email to