]> git.itanic.dy.fi Git - log-plotter/commitdiff
main: Add missing EOF check to serial read
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Fri, 4 Oct 2013 19:52:33 +0000 (22:52 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Fri, 4 Oct 2013 19:53:52 +0000 (22:53 +0300)
If we got EOF from the serial port, close it and exit. Nothing more to
do.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
main.c

diff --git a/main.c b/main.c
index 847a110c3bdbf2932609b8e8e8e3f4c149670166..dd6c7c090a600705da207112849957a85a221990 100644 (file)
--- a/main.c
+++ b/main.c
@@ -55,6 +55,9 @@ int main(int argc, char *argv[])
                        break;
                }
 
+               if (ret == 0)
+                       break;
+
                ret = write(1, buf, ret);
                if (read < 0) {
                        perror("write");