From ddaf94095891a21cedd6a18d9178e4444fb937a7 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 12 Jan 2001 10:53:48 +0000 Subject: Patch from James Graves to better handle m68k. Also fixes 2 very important malloc bugs! Anyone using malloc (esp mmu-less) should update and recompile. -Erik --- libc/inet/resolv.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'libc/inet/resolv.c') diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 18f366e87..91442b3a9 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -56,10 +56,16 @@ #undef DEBUG #ifdef DEBUG -#define DPRINTF(X,args...) printf(X,args...) +static inline void DPRINTF(const char *format, ...) +{ + va_list args; + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); +} #else -#define DPRINTF(X,args...) -#endif /* DEBUG */ +static inline void DPRINTF(const char *format, ...) { } +#endif #ifdef L_encodeh int encode_header(struct resolv_header *h, unsigned char *dest, int maxlen) @@ -481,7 +487,7 @@ int dns_lookup(const char *name, int type, int nscount, const char **nsip, h.qdcount = 1; h.rd = 1; - DPRINTF("encoding header\n"); + DPRINTF("encoding header\n", h.rd); i = encode_header(&h, packet, PACKETSZ); if (i < 0) @@ -554,7 +560,7 @@ int dns_lookup(const char *name, int type, int nscount, const char **nsip, /* unsolicited */ goto again; - DPRINTF("Got response (i think)!\n"); + DPRINTF("Got response %s\n", "(i think)!"); DPRINTF("qrcount=%d,ancount=%d,nscount=%d,arcount=%d\n", h.qdcount, h.ancount, h.nscount, h.arcount); DPRINTF("opcode=%d,aa=%d,tc=%d,rd=%d,ra=%d,rcode=%d\n", @@ -778,7 +784,7 @@ int open_nameservers() } fclose(fp); } else { - DPRINTF("failed to open resolv.conf\n"); + DPRINTF("failed to open %s\n", "resolv.conf"); } DPRINTF("nameservers = %d\n", nameservers); return 0; -- cgit v1.2.3