]> rtime.felk.cvut.cz Git - sojka/sterm.git/blobdiff - sterm.c
Handle hang-up event on stdin
[sojka/sterm.git] / sterm.c
diff --git a/sterm.c b/sterm.c
index e5bf7df51423dfb12428ccd935ad842eb0e31011..040c22f29c9a5ec163c4b944862087f5069068ca 100644 (file)
--- a/sterm.c
+++ b/sterm.c
@@ -1,7 +1,7 @@
 /*
  * Simple serial terminal
  *
- * Copyright 2014, 2015, 2016, 2017 Michal Sojka <sojkam1@fel.cvut.cz>
+ * Copyright 2014, 2015, 2016, 2017, 2019 Michal Sojka <sojkam1@fel.cvut.cz>
  *
  * This program is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -373,6 +373,10 @@ int main(int argc, char *argv[])
                                exit(1);
                        }
                }
+               if (fds[0].revents & POLLHUP) {
+                       VERBOSE("HUP on stdin\r\n");
+                       break;
+               }
                if (fds[1].revents & POLLIN) {
                        r1 = CHECK(read(fd, buf, sizeof(buf)));
                        if (r1 == 0) {