slackbuilds_ponce/network/sntpc/compilefix.diff
B. Watson d17bca972e
network/sntpc: Added (simple NTP client).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2022-01-30 08:36:00 +07:00

45 lines
1.5 KiB
Diff

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");