Commit Diff
Diff:
6ee59c73ba8d8a630fcb4b27d5a60c42a721789e
0806b88d5f73384b57fcbcff352e9a8c314dbca0
Commit:
0806b88d5f73384b57fcbcff352e9a8c314dbca0
Tree:
e8b6bffb0f5b1c1e402262dd0ba8838545a0909d
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Fri Dec 6 16:28:35 2019 UTC
Message:
this makes linux (raspberry pi) compile cleanly. There would still be the warning without the -Wno-shift-count-overflow, but I settled on checking the sizeof(time_t) in the source and if it's 4 then set the value to 0, the execution code would never overflow on the the right shift count.
blob - 77d7d62cc123493b4953864988543a65f35b4ade
blob + 7c570374cb297e07552e0c57bd3b263709ac85e3
--- Makefile.linux
+++ Makefile.linux
@@ -1,6 +1,6 @@
CC=gcc
#CFLAGS=-DDEBUG
-CFLAGS=-D_XOPEN_SOURCE -D_DEFAULT_SOURCE
+CFLAGS=-D_XOPEN_SOURCE -D_DEFAULT_SOURCE -Wno-shift-count-overflow
LDADD= -lresolv -lcrypto -lrt -lbsd
YACC=bison
AR=ar
@@ -69,12 +69,14 @@ dnssec.o: dnssec.c
$(CC) $(CFLAGS) -c dnssec.c
util.o: util.c
+ CFLAGS+=-Wno-shift-count-overflow
$(CC) $(CFLAGS) -c util.c
ent.o: ent.c
$(CC) $(CFLAGS) -c ent.c
raxfr.o: raxfr.c
+ CFLAGS+=-Wno-shift-count-overflow
$(CC) $(CFLAGS) -c raxfr.c
blob - 7ed081206f4eff172e8042ef811a1c0a528c687f
blob + 9860b4deb86076afc124a8682037113494f2e3ec
--- raxfr.c
+++ raxfr.c
@@ -26,7 +26,7 @@
*
*/
/*
- * $Id: raxfr.c,v 1.43 2019/12/04 06:52:55 pjp Exp $
+ * $Id: raxfr.c,v 1.44 2019/12/06 16:28:35 pjp Exp $
*/
#include <sys/types.h>
@@ -1832,7 +1832,10 @@ get_remote_soa(struct rzone *rzone)
free(algname);
/* time 1 */
- pack16(&query[totallen], htons((now >> 32) & 0xffff));
+ if (sizeof(time_t) == 4) /* 32-bit time_t */
+ pack16(&query[totallen], 0);
+ else
+ pack16(&query[totallen], htons((now >> 32) & 0xffff));
totallen += 2;
/* time 2 */
blob - 22bdebe413edc01c005b0d1e7ffea9a18a6157a6
blob + 382c21f632abf05d0c0afaf35e382d849c09868c
--- util.c
+++ util.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: util.c,v 1.56 2019/12/04 06:52:55 pjp Exp $
+ * $Id: util.c,v 1.57 2019/12/06 16:28:35 pjp Exp $
*/
#include <sys/types.h>
@@ -1654,7 +1654,10 @@ tsig_pseudoheader(char *tsigkeyname, uint16_t fudge, t
/* time 1 and 2 */
now = time(NULL);
- pack16(p, htons((now >> 32) & 0xffff));
+ if (sizeof(time_t) == 4) /* 32-bit time_t */
+ pack16(p, 0);
+ else
+ pack16(p, htons((now >> 32) & 0xffff));
ppoffset += 2;
p += 2;
@@ -1938,7 +1941,10 @@ lookup_axfr(FILE *f, int so, char *zonename, struct so
p += len;
/* time 1 */
- pack16(p, htons((now >> 32) & 0xffff));
+ if (sizeof(time_t) == 4) /* 32-bit time-t */
+ pack16(p, 0);
+ else
+ pack16(p, htons((now >> 32) & 0xffff));
totallen += 2;
p += 2;
repomaster@centroid.eu