From 14e1f568461b564c1fee79a0256817fc041bc3f2 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Fri, 4 Oct 2013 22:52:33 +0300 Subject: [PATCH] main: Add missing EOF check to serial read If we got EOF from the serial port, close it and exit. Nothing more to do. Signed-off-by: Timo Kokkonen --- main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.c b/main.c index 847a110..dd6c7c0 100644 --- 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"); -- 2.44.0