From d17bca972e018b295b8f887af0c3967ba99d4cf5 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 26 Jan 2022 15:33:58 -0500 Subject: network/sntpc: Added (simple NTP client). Signed-off-by: Willy Sudiarto Raharjo --- network/sntpc/compilefix.diff | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 network/sntpc/compilefix.diff (limited to 'network/sntpc/compilefix.diff') diff --git a/network/sntpc/compilefix.diff b/network/sntpc/compilefix.diff new file mode 100644 index 0000000000000..e56b2a70a7edb --- /dev/null +++ b/network/sntpc/compilefix.diff @@ -0,0 +1,45 @@ +diff -Naur sntpc-20181113_1ca1d00/sntpc.c sntpc-20181113_1ca1d00.patched/sntpc.c +--- sntpc-20181113_1ca1d00/sntpc.c 2022-01-26 14:17:03.000000000 -0500 ++++ sntpc-20181113_1ca1d00.patched/sntpc.c 2022-01-26 14:29:36.384241954 -0500 +@@ -7,9 +7,12 @@ + #include + #include + #include ++#include + #include + #include + ++extern uint32_t arc4random(void); ++ + #define SECONDS_1900_1970 (25567 * 86400U) + + #pragma pack(1) +@@ -56,10 +59,6 @@ + errx(1, "Structure size mismatch (got %lu, expected 68)", sizeof(struct ntp_packet_t)); + } + +- if (pledge("stdio inet dns settime", NULL) < 0) { +- err(1, "pledge"); +- } +- + int ch; + while ((ch = getopt(argc, argv, "bhnp:s:t:v")) != -1) { + switch (ch) { +@@ -184,7 +183,7 @@ + + time_t local_now = time(NULL); + if (verbose) { +- printf("sntpc: local clock %lld (%.24s)\n", local_now, ctime(&local_now)); ++ printf("sntpc: local clock %ld (%.24s)\n", local_now, ctime(&local_now)); + } + if (local_now > seconds_since_1970 && !backwards) { + errx(1, "not stepping clock backwards (use -b to allow this)"); +@@ -205,7 +204,7 @@ + err(1, "settimeofday"); + } + if (verbose) { +- printf("sntpc: local clock set to %lld (%.24s)\n", new_clock.tv_sec, ctime(&new_clock.tv_sec)); ++ printf("sntpc: local clock set to %ld (%.24s)\n", new_clock.tv_sec, ctime(&new_clock.tv_sec)); + } + } else { + printf("sntpc: not setting clock because of -n\n"); -- cgit v1.2.3