- Fix build with gcc 4.2

PR:		118791
Submitted by:	Pietro Cerutti <gahr@gahr.ch>
This commit is contained in:
Martin Wilke 2007-12-18 18:38:52 +00:00
parent a72f5504dd
commit a50d4187ad
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=204017
2 changed files with 242 additions and 8 deletions

View File

@ -27,7 +27,7 @@ PLIST_FILES= bin/dnsbench bin/pgsqldns bin/pgsqldns-conf bin/pgsqldnscache \
share/examples/${PORTNAME}/create.sql
PLIST_DIRS= share/examples/${PORTNAME}
pre-build:
post-configure:
${CP} -R ${DJ_SRC} ${WRKSRC}/djbdns-1.05
${PATCH} < ${WRKSRC}/djbdns-1.05.patch -d ${WRKSRC}/djbdns-1.05
${MV} ${WRKSRC}/sqldns-schema.html ${WRKSRC}/pgsqldns-schema.html
@ -42,10 +42,4 @@ post-install:
.endfor
.endif
.include <bsd.port.pre.mk>
.if ${OSVERSION} >= 700042
BROKEN= Does not compile with GCC 4.2
.endif
.include <bsd.port.post.mk>
.include <bsd.port.mk>

View File

@ -0,0 +1,240 @@
--- djbdns-1.05.patch.orig 2007-08-26 15:08:50.000000000 +0200
+++ djbdns-1.05.patch 2007-12-17 21:34:49.000000000 +0100
@@ -1757,8 +1757,8 @@
{
=== modified file 'query.c'
---- query.c 2004-07-08 11:45:45 +0000
-+++ query.c 2007-08-23 21:11:49 +0000
+--- query.c.orig 2007-12-17 21:14:09.000000000 +0100
++++ query.c 2007-12-17 21:33:24.000000000 +0100
@@ -12,6 +12,15 @@
#include "alloc.h"
#include "response.h"
@@ -1775,7 +1775,7 @@
static int flagforwardonly = 0;
-@@ -20,10 +29,32 @@
+@@ -20,10 +29,31 @@
flagforwardonly = 1;
}
@@ -1790,12 +1790,11 @@
+#ifdef SQLCACHE
+unsigned int db_reinsert_interval = 1*60*60;
+unsigned int db_insert_minttl = 10*60;
-+extern unsigned int save_ok;
+#endif
++static unsigned int save_ok;
+
+char save_buf[8192];
+unsigned int save_len;
-+static unsigned int save_ok;
+
static void cachegeneric(const char type[2],const char *d,const char *data,unsigned int datalen,uint32 ttl)
{
@@ -1808,7 +1807,7 @@
len = dns_domain_length(d);
if (len > 255) return;
-@@ -32,13 +63,26 @@
+@@ -32,13 +62,26 @@
byte_copy(key + 2,len,d);
case_lowerb(key + 2,len);
@@ -1839,7 +1838,7 @@
static void save_start(void)
{
save_len = 0;
-@@ -193,6 +237,7 @@
+@@ -193,6 +236,7 @@
int k;
int p;
int q;
@@ -1847,7 +1846,7 @@
errno = error_io;
if (state == 1) goto HAVEPACKET;
-@@ -236,7 +281,9 @@
+@@ -236,7 +280,9 @@
response_rfinish(RESPONSE_ANSWER);
}
cleanup(z);
@@ -1857,7 +1856,7 @@
return 1;
}
-@@ -246,7 +293,10 @@
+@@ -246,7 +292,10 @@
case_lowerb(key + 2,dlen);
cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
if (cached) {
@@ -1868,7 +1867,7 @@
goto NXDOMAIN;
}
-@@ -254,13 +304,17 @@
+@@ -254,13 +303,17 @@
cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
if (cached) {
if (typematch(DNS_T_CNAME,dtype)) {
@@ -1886,7 +1885,7 @@
if (!dns_domain_copy(&cname,cached)) goto DIE;
goto CNAME;
}
-@@ -269,7 +323,9 @@
+@@ -269,7 +322,9 @@
byte_copy(key,2,DNS_T_NS);
cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
if (cached && (cachedlen || byte_diff(dtype,2,DNS_T_ANY))) {
@@ -1896,7 +1895,7 @@
if (!rqa(z)) goto DIE;
pos = 0;
while (pos = dns_packet_getname(cached,cachedlen,pos,&t2)) {
-@@ -286,7 +342,9 @@
+@@ -286,7 +341,9 @@
byte_copy(key,2,DNS_T_PTR);
cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
if (cached && (cachedlen || byte_diff(dtype,2,DNS_T_ANY))) {
@@ -1906,7 +1905,7 @@
if (!rqa(z)) goto DIE;
pos = 0;
while (pos = dns_packet_getname(cached,cachedlen,pos,&t2)) {
-@@ -303,7 +361,9 @@
+@@ -303,7 +360,9 @@
byte_copy(key,2,DNS_T_MX);
cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
if (cached && (cachedlen || byte_diff(dtype,2,DNS_T_ANY))) {
@@ -1916,7 +1915,7 @@
if (!rqa(z)) goto DIE;
pos = 0;
while (pos = dns_packet_copy(cached,cachedlen,pos,misc,2)) {
-@@ -324,7 +384,9 @@
+@@ -324,7 +383,9 @@
cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
if (cached && (cachedlen || byte_diff(dtype,2,DNS_T_ANY))) {
if (z->level) {
@@ -1926,7 +1925,7 @@
while (cachedlen >= 4) {
for (k = 0;k < 64;k += 4)
if (byte_equal(z->servers[z->level - 1] + k,4,"\0\0\0\0")) {
-@@ -337,7 +399,9 @@
+@@ -337,7 +398,9 @@
goto LOWERLEVEL;
}
@@ -1936,7 +1935,7 @@
if (!rqa(z)) goto DIE;
while (cachedlen >= 4) {
if (!response_rstart(d,DNS_T_A,ttl)) goto DIE;
-@@ -355,7 +419,9 @@
+@@ -355,7 +418,9 @@
byte_copy(key,2,dtype);
cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
if (cached && (cachedlen || byte_diff(dtype,2,DNS_T_ANY))) {
@@ -1946,7 +1945,7 @@
if (!rqa(z)) goto DIE;
while (cachedlen >= 2) {
uint16_unpack_big(cached,&datalen);
-@@ -396,7 +462,9 @@
+@@ -396,7 +461,9 @@
pos = 0;
j = 0;
while (pos = dns_packet_getname(cached,cachedlen,pos,&t1)) {
@@ -1956,7 +1955,7 @@
if (j < QUERY_MAXNS)
if (!dns_domain_copy(&z->ns[z->level][j++],t1)) goto DIE;
}
-@@ -430,12 +498,16 @@
+@@ -430,12 +497,16 @@
dns_sortip(z->servers[z->level],64);
if (z->level) {
@@ -1975,7 +1974,7 @@
}
return 0;
-@@ -590,15 +662,19 @@
+@@ -590,15 +661,19 @@
pos = dns_packet_getname(buf,len,pos + 10,&t2); if (!pos) goto DIE;
pos = dns_packet_getname(buf,len,pos,&t3); if (!pos) goto DIE;
pos = dns_packet_copy(buf,len,pos,misc,20); if (!pos) goto DIE;
@@ -1995,7 +1994,7 @@
cachegeneric(DNS_T_CNAME,t1,t2,dns_domain_length(t2),ttl);
}
else if (byte_equal(type,2,DNS_T_PTR)) {
-@@ -606,7 +682,9 @@
+@@ -606,7 +681,9 @@
while (i < j) {
pos = dns_packet_skipname(buf,len,records[i]); if (!pos) goto DIE;
pos = dns_packet_getname(buf,len,pos + 10,&t2); if (!pos) goto DIE;
@@ -2005,7 +2004,7 @@
save_data(t2,dns_domain_length(t2));
++i;
}
-@@ -617,7 +695,9 @@
+@@ -617,7 +694,9 @@
while (i < j) {
pos = dns_packet_skipname(buf,len,records[i]); if (!pos) goto DIE;
pos = dns_packet_getname(buf,len,pos + 10,&t2); if (!pos) goto DIE;
@@ -2015,7 +2014,7 @@
save_data(t2,dns_domain_length(t2));
++i;
}
-@@ -629,7 +709,9 @@
+@@ -629,7 +708,9 @@
pos = dns_packet_skipname(buf,len,records[i]); if (!pos) goto DIE;
pos = dns_packet_copy(buf,len,pos + 10,misc,2); if (!pos) goto DIE;
pos = dns_packet_getname(buf,len,pos,&t2); if (!pos) goto DIE;
@@ -2025,7 +2024,7 @@
save_data(misc,2);
save_data(t2,dns_domain_length(t2));
++i;
-@@ -643,8 +725,13 @@
+@@ -643,8 +724,13 @@
pos = dns_packet_copy(buf,len,pos,header,10); if (!pos) goto DIE;
if (byte_equal(header + 8,2,"\0\4")) {
pos = dns_packet_copy(buf,len,pos,header,4); if (!pos) goto DIE;
@@ -2039,7 +2038,7 @@
}
++i;
}
-@@ -659,7 +746,9 @@
+@@ -659,7 +745,9 @@
if (datalen > len - pos) goto DIE;
save_data(header + 8,2);
save_data(buf + pos,datalen);
@@ -2049,7 +2048,7 @@
++i;
}
save_finish(type,t1,ttl);
-@@ -689,13 +778,21 @@
+@@ -689,13 +777,21 @@
}
if (rcode == 3) {
@@ -2072,7 +2071,7 @@
cleanup(z);
return 1;
}
-@@ -706,10 +803,13 @@
+@@ -706,10 +802,13 @@
if (byte_diff(DNS_T_CNAME,2,dtype)) {
save_start();
save_finish(dtype,d,soattl);
@@ -2087,8 +2086,6 @@
if (flagout || flagsoa || !flagreferral) {
-
-=== modified file 'query.h'
--- query.h 2004-07-08 11:45:45 +0000
+++ query.h 2007-08-23 20:36:07 +0000
@@ -28,5 +28,6 @@
@@ -2446,3 +2443,5 @@
if (cdb_make_finish(&cdb) == -1) die_datatmp();
if (fsync(fdcdb) == -1) die_datatmp();
+
+