Make sense to handle 0, end of file. But as it is NOT an error, perhaps it should use a proper pr_info().
Erez -----Original Message----- From: Lars Munch <l...@segv.dk> Sent: Friday, 14 May 2021 13:34 To: linuxptp-devel@lists.sourceforge.net Subject: [Linuxptp-devel] [PATCH 2/4] ts2phc: Close socket on peer shutdown 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://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Flinuxptp-devel&data=04%7C01%7Cerez.geva.ext%40siemens.com%7C1dac059442c145cbbf9e08d916d0a8c4%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637565907704909454%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=RjhfkcVf7M46tr%2BrAquaCttDpc38MA7wrAWIu2yT%2FgI%3D&reserved=0 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel