This is the mail archive of the glibc-bugs@sourceware.org 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]

[Bug network/15635] New: getaddrinfo returns EAI_SYSTEM or EAI_NONAME depending on whether nscd is used


http://sourceware.org/bugzilla/show_bug.cgi?id=15635

            Bug ID: 15635
           Summary: getaddrinfo returns EAI_SYSTEM or EAI_NONAME depending
                    on whether nscd is used
           Product: glibc
           Version: 2.17
            Status: NEW
          Severity: normal
          Priority: P2
         Component: network
          Assignee: unassigned at sourceware dot org
          Reporter: ludo at gnu dot org

This program asks for a non-existent name:

  #include <errno.h>
  #include <netdb.h>
  #include <stdio.h>
  #include <string.h>

  int
  main(int argc, char **argv)
  {
    struct addrinfo c_hints, *c_result;

    memset(&c_hints, 0, sizeof (c_hints));
    const int err = getaddrinfo ("does-not-exist",
                                 NULL,
                                 &c_hints,
                                 &c_result);
    if (err == 0)
      freeaddrinfo (c_result);

    printf("err: %d\n", err);
    printf("errno: %d\n", errno);

    return 0;
  }

When nscd is running, this returns EAI_NONAME (as expected).
When nscd is not running, this returns EAI_SYSTEM with errno == ENOENT.

The discrepancy looks bogus, and EAI_NONAME looks more appropriate.

(Originally reported at
<http://lists.gnu.org/archive/html/guile-devel/2013-06/msg00032.html>.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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