Subject: lib/25707: res_ninit broken
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <lha@netbsd.org>
List: netbsd-bugs
Date: 05/25/2004 23:03:35
>Number: 25707
>Category: lib
>Synopsis: res_ninit broken
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue May 25 21:04:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Love
>Release: NetBSD 2.0E
>Organization:
>Environment:
System: NetBSD nutcracker.stacken.kth.se 2.0E NetBSD 2.0E (NUTCRACKER) #86: Tue May 25 00:18:22 CEST 2004 lha@nutcracker.stacken.kth.se:/usr/src/sys/arch/i386/compile/NUTCRACKER i386
Architecture: i386
Machine: i386
>Description:
struct __res_state is diffrent in libc and on the outside
libc, this breaks everything that tries to use res_ninit.
>How-To-Repeat:
: lha@nutcracker ; cat foo.c
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <resolv.h>
#include <err.h>
int
main(int argc, char **argv)
{
int foo[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }, i;
struct __res_state stat;
int bar[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
res_ninit(&stat);
for (i = 0; i < sizeof(foo)/sizeof(foo[0]); i++) {
if (bar[i] != i)
errx(1, "bar[i] != i, %d", i);
if (foo[i] != i)
errx(1, "foo[i] != i, %d", i);
}
return 0;
}
: lha@nutcracker ; gcc -o foo foo.c
: lha@nutcracker ; ./foo
foo: foo[i] != i, 5
>Fix:
remove _LIBC from resolv.h ?
>Release-Note:
>Audit-Trail:
>Unformatted: