Svante Signell, le Wed 29 Jan 2014 13:47:34 +0100, a écrit :
> --- 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;

st.st_size?  Again, that'll give you the size of the file, not the size
of its name.

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

Instead of hardcoding __GNU__, simply use an #ifdef IPV6_RECVPKTINFO.

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


-- 
Samuel
After watching my newly-retired dad spend two weeks learning how to make a new
folder, it became obvious that "intuitive" mostly means "what the writer or
speaker of intuitive likes".
(Bruce Ediger, bedi...@teal.csn.org, in comp.os.linux.misc, on X the
intuitiveness of a Mac interface.)


-- 
To UNSUBSCRIBE, email to debian-hurd-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/20140207004712.go5...@type.youpi.perso.aquilenet.fr

Reply via email to