Package: wide-dhcpv6 / 20080615-22

0011-resolv-warnings-so-as-to-make-blhc-and-gcc-both-happ.patch Patch series | download
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
From: Roger Shimizu <rogershimizu@gmail.com>
Date: Wed, 2 Nov 2016 00:32:22 +0900
Subject: resolv warnings so as to make "blhc" and "gcc" both happy

- blhc complained: lacking of CFLAGS/CPPFLAGS for C files in Makefile
- gcc complained implicit declaration of function 'time'
- gcc complained ignoring return value of 'read'
- adjust objects dependency and make parallel build working

Signed-off-by: Roger Shimizu <rogershimizu@gmail.com>
---
 Makefile.in          | 21 +++++++++++----------
 addrconf.c           | 11 ++++++++++-
 missing/arc4random.c |  3 ++-
 prefixconf.c         | 11 ++++++++++-
 4 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index de25f48..1ad6c25 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -36,7 +36,7 @@ localdbdir= @localdbdir@
 user= @user@
 group= @group@
 
-CFLAGS=	@CFLAGS@ @DEFS@ -DSYSCONFDIR=\"${sysconfdir}\" \
+CFLAGS=	@CFLAGS@ @CPPFLAGS@ @DEFS@ -DSYSCONFDIR=\"${sysconfdir}\" \
 	-DLOCALDBDIR=\"${localdbdir}\"
 LDFLAGS=@LDFLAGS@
 LIBOBJS=@LIBOBJS@
@@ -73,7 +73,8 @@ dhcp6relay: $(RELAYOBJS) $(LIBOBJS)
 dhcp6ctl: $(CTLOBJS)
 	$(CC) $(LDFLAGS) -o $@ $(CTLOBJS) $(LIBOBJS) $(LIBS)
 
-cfparse.c y.tab.h: cfparse.y
+cfparse.c: y.tab.h
+y.tab.h: cfparse.y
 	@YACC@ -d cfparse.y
 	mv y.tab.c cfparse.c
 
@@ -82,21 +83,21 @@ cftoken.c: cftoken.l y.tab.h
 	mv lex.yy.c $@	
 
 getaddrinfo.o:	$(srcdir)/missing/getaddrinfo.c
-	$(CC) -c $(srcdir)/missing/$*.c
+	$(CC) -c $(CFLAGS) $(srcdir)/missing/$*.c
 getnameinfo.o:	$(srcdir)/missing/getnameinfo.c
-	$(CC) -c $(srcdir)/missing/$*.c
+	$(CC) -c $(CFLAGS) $(srcdir)/missing/$*.c
 strlcat.o:	$(srcdir)/missing/strlcat.c
-	$(CC) -c $(srcdir)/missing/$*.c
+	$(CC) -c $(CFLAGS) $(srcdir)/missing/$*.c
 strlcpy.o:	$(srcdir)/missing/strlcpy.c
-	$(CC) -c $(srcdir)/missing/$*.c
+	$(CC) -c $(CFLAGS) $(srcdir)/missing/$*.c
 arc4random.o:	$(srcdir)/missing/arc4random.c
-	$(CC) $(CFLAGS) -c $(srcdir)/missing/$*.c
+	$(CC) -c $(CFLAGS) $(srcdir)/missing/$*.c
 getifaddrs.o:	$(srcdir)/missing/getifaddrs.c
-	$(CC) -c $(srcdir)/missing/$*.c
+	$(CC) -c $(CFLAGS) $(srcdir)/missing/$*.c
 daemon.o:	$(srcdir)/missing/daemon.c
-	$(CC) -c $(srcdir)/missing/$*.c
+	$(CC) -c $(CFLAGS) $(srcdir)/missing/$*.c
 warnx.o:	$(srcdir)/missing/warnx.c
-	$(CC) -c $(srcdir)/missing/$*.c
+	$(CC) -c $(CFLAGS) $(srcdir)/missing/$*.c
 
 $(srcdir)/ianaopts.h: gentab.pl bootp-dhcp-parameters
 	expand bootp-dhcp-parameters | perl gentab.pl > ianaopts.h
diff --git a/addrconf.c b/addrconf.c
index 47f1738..a8c52bc 100644
--- a/addrconf.c
+++ b/addrconf.c
@@ -29,11 +29,20 @@
  * SUCH DAMAGE.
  */
 #include <sys/types.h>
-#include <sys/time.h>
 #include <sys/socket.h>
 #include <sys/queue.h>
 #include <sys/ioctl.h>
 
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
 #include <net/if.h>
 #ifdef __FreeBSD__
 #include <net/if_var.h>
diff --git a/missing/arc4random.c b/missing/arc4random.c
index 8d1e050..7fe143b 100644
--- a/missing/arc4random.c
+++ b/missing/arc4random.c
@@ -59,9 +59,10 @@ u_int32_t
 arc4random()
 {
 	u_int32_t v;
+	ssize_t n;
 
 	if (fd < 0)
 		arc4random_init();
-	read(fd, &v, sizeof(v));
+	n = read(fd, &v, sizeof(v));
 	return v;
 }
diff --git a/prefixconf.c b/prefixconf.c
index 9450a3f..15b5417 100644
--- a/prefixconf.c
+++ b/prefixconf.c
@@ -29,11 +29,20 @@
  * SUCH DAMAGE.
  */
 #include <sys/types.h>
-#include <sys/time.h>
 #include <sys/socket.h>
 #include <sys/queue.h>
 #include <sys/ioctl.h>
 
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
 #include <net/if.h>
 #ifdef __FreeBSD__
 #include <net/if_var.h>