Browse Source

handle closing fds

Jan Klemkow 6 years ago
parent
commit
ea938bbb04
1 changed files with 3 additions and 0 deletions
  1. 3 0
      scroll.c

+ 3 - 0
scroll.c

@@ -480,6 +480,9 @@ main(int argc, char *argv[])
 			doredraw = false;
 		}
 
+		if (pfd[0].revents & POLLHUP || pfd[1].revents & POLLHUP)
+			break;
+
 		if (pfd[0].revents & POLLIN) {
 			ssize_t n = read(STDIN_FILENO, input, sizeof(input)-1);