Currently ts2phc prints "poll failed" error to the LOG_EMERG when
the poll for tod fails. This causes error print on all terminals
when the tool gets terminated using SIGINT (ex. by pressing CTRL+C).

This patch adds the check if the tool is still running before
reporting the error.

Signed-off-by: Maciek Machnikowski <mac...@machnikowski.net>
---
 ts2phc.c          | 3 ++-
 ts2phc_pps_sink.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ts2phc.c b/ts2phc.c
index 4393059..7d19de6 100644
--- a/ts2phc.c
+++ b/ts2phc.c
@@ -763,7 +763,8 @@ int main(int argc, char *argv[])
 
                err = ts2phc_pps_sink_poll(&priv);
                if (err < 0) {
-                       pr_err("poll failed");
+                       if (is_running())
+                               pr_err("poll failed");
                        break;
                }
                if (err > 0) {
diff --git a/ts2phc_pps_sink.c b/ts2phc_pps_sink.c
index d25bc89..731a819 100644
--- a/ts2phc_pps_sink.c
+++ b/ts2phc_pps_sink.c
@@ -384,7 +384,8 @@ int ts2phc_pps_sink_poll(struct ts2phc_private *priv)
                        if (errno == -EINTR) {
                                return 0;
                        } else {
-                               pr_emerg("poll failed");
+                               if (is_running())
+                                       pr_emerg("poll failed");
                                return -1;
                        }
                } else if (!cnt) {
-- 
2.30.2



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

Reply via email to