diff options
-rw-r--r-- | tailburst.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tailburst.c b/tailburst.c index 634dc92..f3b63c9 100644 --- a/tailburst.c +++ b/tailburst.c @@ -100,7 +100,7 @@ int main(int argc, char **argv) fcntl(fd, F_SETFL, flags); pollfd.fd = fd; - pollfd.events = POLLIN; + pollfd.events = POLLIN | POLLHUP; while (poll(&pollfd, 1, -1) > 0) { cur = NULL; while ((nread = fdgetline(fd, &line)) > 0) @@ -108,6 +108,9 @@ int main(int argc, char **argv) if (cur) printf("%s\n", cur); + + if (pollfd.revents & POLLHUP) + break; } return 0; |