This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Purpose of _LIBC in resolv/ ?

Hello list,

Could somebody explain to me what is the purpose of #ifdef _LIBC in resolv/ ?

1) Why resolver should behave differently when it is compiled into libc and into application?

2) It seems that code in resolv/ directory cannot be compiled without _LIBC at least from 2008-12-03 (commit 6f5c3117). I hope I read the code correctly:

__res_vinit(res_state statp, int preinit) {
        FILE *fp;
        char *cp, **pp;
        int n;
        char buf[BUFSIZ];
        int nserv = 0;    /* number of nameserver records read from file */
#ifdef _LIBC
        int nservall = 0; /* number of NS records read, nserv IPv4 only */
// snip
#ifdef _LIBC
                if (MATCH(buf, "nameserver") && nservall < MAXNS) {
                if (MATCH(buf, "nameserver") && nserv < MAXNS) {
                    struct in_addr a;

                    cp = buf + sizeof("nameserver") - 1;
                    while (*cp == ' ' || *cp == '\t')
                    if ((*cp != '\0') && (*cp != '\n')
                        && __inet_aton(cp, &a)) {
// the problem is that nservall is not declared without _LIBC
                        statp->nsaddr_list[nservall].sin_addr = a;
                        statp->nsaddr_list[nservall].sin_family = AF_INET;
                        statp->nsaddr_list[nservall].sin_port =
#ifdef _LIBC
                    } else {
// snip

I'm going to write a patch for DNSSEC support. Can I remove this _LIBC magic as the first step, before I dive into DNSSEC?

Please explain me the purpose of this if it has to stay there.

Thank you for your time!

Petr Spacek  @  Red Hat

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]