Read returns 0 (the traditional "end-of-file" return) when a remote
peer performs an orderly shutdown. Hence, ts2phc needs to close the
socket and try to establish a new connection.

Signed-off-by: Lars Munch <l...@segv.dk>
---
 ts2phc_nmea_master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ts2phc_nmea_master.c b/ts2phc_nmea_master.c
index b031e65..2fc460d 100644
--- a/ts2phc_nmea_master.c
+++ b/ts2phc_nmea_master.c
@@ -115,7 +115,7 @@ static void *monitor_nmea_status(void *arg)
                        continue;
                }
                cnt = read(pfd.fd, input, sizeof(input));
-               if (cnt < 0) {
+               if (cnt <= 0) {
                        pr_err("failed to read from nmea source");
                        close(pfd.fd);
                        pfd.fd = -1;
-- 
2.25.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to