[Linuxptp-devel] [PATCH v3 3/4] Don't accept errors in clockadj_get_freq().
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
|
From: Miroslav L. <mli...@re...> - 2022-10-24 13:25:43
|
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 <mli...@re...>
---
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
|