[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pdns: FTBFS on hurd-i386 (for review)



Svante Signell, le Wed 25 Jun 2014 13:01:49 +0200, a écrit :
> @@ -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;

Err, did you have a look at what st.st_size was?  For a directory,
it'll be the size of the directory listing in bytes, which
is completely unrelated to the path. Why not simply using
params["include-dir"].length() ?

> +            namebuf = (char*)malloc(len);

This will allocate a buffer on each while loop...

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

... but free only one of them, the latest...

> --- 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

As usual, don't make the code GNU-specific, use #ifndef IPV6_RECVPKTINFO
instead.

Samuel


Reply to: