Exit if an error is returned from the clock_adjtime() call in
clockadj_get_freq(). No recoverable errors are expected.

Signed-off-by: Miroslav Lichvar <mlich...@redhat.com>
---
 clockadj.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clockadj.c b/clockadj.c
index 957dc57..4c920b9 100644
--- a/clockadj.c
+++ b/clockadj.c
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <math.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
@@ -72,6 +73,7 @@ double clockadj_get_freq(clockid_t clkid)
        memset(&tx, 0, sizeof(tx));
        if (clock_adjtime(clkid, &tx) < 0) {
                pr_err("failed to read out the clock frequency adjustment: %m");
+               exit(1);
        } else {
                f = tx.freq / 65.536;
                if (clkid == CLOCK_REALTIME && realtime_nominal_tick && tx.tick)
-- 
2.37.3



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

Reply via email to