aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2016-12-06 21:49:15 +0100
committerBoris Faure <billiob@gmail.com>2016-12-06 21:49:15 +0100
commit273a85af0050bb0f604c88dcf0942a60eb848db2 (patch)
treebe147beae4b446257e463243a5e1c92bc04eb04f
parenttermpty: handle read() from tty pair when the other end has died, on some BSD (diff)
downloadterminology-273a85af0050bb0f604c88dcf0942a60eb848db2.tar.gz
termpty: handle BSD special case when the other side of the tty pair has quit
-rw-r--r--src/bin/termpty.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index dcdfdfc..0d5f77d 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -172,6 +172,13 @@ _cb_fd_read(void *data, Ecore_Fd_Handler *fd_handler)
if (ty->fd == -1)
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;
+#endif
+
// read up to 64 * 4096 bytes
for (reads = 0; reads < 64; reads++)
{