aboutsummaryrefslogtreecommitdiff
path: root/network/sntpc/compilefix.diff
blob: e56b2a70a7edb9dfabd5f90ee2fd8ee709bb9005 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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 <strings.h>
 #include <sys/select.h>
 #include <sys/socket.h>
+#include <time.h>
 #include <sys/time.h>
 #include <unistd.h>
 
+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");