Subject: lib/32616: Syntax error in debug version of file lib/libc/net/gethanamaddr.c
To: None <,,>
From: None <>
List: netbsd-bugs
Date: 01/24/2006 15:30:00
>Number:         32616
>Category:       lib
>Synopsis:       Syntax error in debug version of file lib/libc/net/gethanamaddr.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 24 15:30:00 +0000 2006
>Originator:     Yves-Emmanuel JUTARD
>Release:        3.0.0
THALES Communications France
custom environment : recompiled from /src, only some parts of NetBSD are used (TCP/IP stack and some parts of the kernel). Target : PPC custom board.
Compiler used : Metrowerks CodeWarrior embedded PPC 8.1
if the macro 'DEBUG' is set, a function is defined localy in file 'lib/libc/net/gethanamaddr.c'
l. 136, 'dprintf' is defined with 'res_state *' as its second argument, which looks like a pointer.

However, 'res_state' is ALREADY a pointer on 'struct __res_state' (defined in include/resolv.h). So the second arg is in fact a pointer on a pointer. But in the function, the fields of struct __res_state are accessed directly like if it was a simple pointer. And every call of dprintf is done with a 'res_state' as second arg, not a 'res_state *'.

It really looks like the function prototype is incorrect, both regarding its implementation and its use. I guess that no one must have recompiled this file with 'DEBUG' option for a while. My compiler yell as soon as I try.

try to compile 'lib/libc/net/gethanamaddr.c' with macro DEBUG defined.
Correct the prototype of function 'dprintf' in DEBUG mode.