pdns: FTBFS on hurd-i386 (for review)
(Sent to debian-hurd for review)
Source: pdns
Version: 3.3-2
Severity: important
Tags: patch
User: debian-hurd@lists.debian.org
Usertags: hurd
Hi,
pdns fails to build from source on GNU/Hurd due to two
reasons:
1) pdns/arguments.cc: PATH_MAX is not defined on GNU/Hurd. Replace that
construct with the usage of the st_size parameter of a previously made
stat() call togeter with strlen (and allocating space for / and the
string terminating \0).
2) pdns/nameserver.c: IPV6_RECVPKTINFO is not defined on GNU/Hurd, use
IPV6_RXINFO instead.
The attached patch fixes these problems.
Thanks!
--- a/pdns/arguments.cc 2014-01-28 12:46:42.000000000 +0100
+++ b/pdns/arguments.cc 2014-01-28 13:25:29.000000000 +0100
@@ -459,7 +459,8 @@ bool ArgvMap::file(const char *fname, bo
struct stat st;
DIR *dir;
struct dirent *ent;
- char namebuf[PATH_MAX] = {0};
+ char *namebuf = NULL;
+ int len;
// stat
if (stat(params["include-dir"].c_str(), &st)) {
@@ -483,7 +484,9 @@ bool ArgvMap::file(const char *fname, bo
if (ent->d_name[0] == '.') continue; // skip any dots
if (boost::ends_with(ent->d_name, ".conf")) {
// ensure it's readable file
- snprintf(namebuf, sizeof namebuf, "%s/%s", params["include-dir"].c_str(), ent->d_name);
+ len = st.st_size + 1 + strlen(ent->d_name) + 1;
+ namebuf = (char*)malloc(len);
+ snprintf(namebuf, len, "%s/%s", params["include-dir"].c_str(), ent->d_name);
if (stat(namebuf, &st) || !S_ISREG(st.st_mode)) {
L << Logger::Error << namebuf << " is not a file" << std::endl;
throw ArgException(std::string(namebuf) + " does not exist!");
@@ -498,6 +501,7 @@ bool ArgvMap::file(const char *fname, bo
throw ArgException(fn + " could not be parsed");
}
}
+ free(namebuf);
}
return true;
--- a/pdns/nameserver.cc 2013-07-05 07:35:05.000000000 +0200
+++ b/pdns/nameserver.cc 2014-01-28 13:57:36.000000000 +0100
@@ -213,7 +213,11 @@ void UDPNameserver::bindIPv6()
if(IsAnyAddress(locala)) {
int val=1;
setsockopt(s, IPPROTO_IP, GEN_IP_PKTINFO, &val, sizeof(val)); // linux supports this, so why not - might fail on other systems
+#ifdef __GNU__ // Same as IPV6_PKTINFO
+ setsockopt(s, IPPROTO_IPV6, IPV6_RXINFO, &val, sizeof(val));
+#else
setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &val, sizeof(val));
+#endif
setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &val, sizeof(val)); // if this fails, we report an error in tcpreceiver too
}
g_localaddresses.push_back(locala);
Reply to: