[PATCH] Avoid unconditional debugging printf in res_query.c

Jakub Jelinek jakub@redhat.com
Thu Aug 12 14:46:00 GMT 2004


Hi!

We certainly shouldn't pollute stdout by default...

2004-08-12  Jakub Jelinek  <jakub@redhat.com>

	* resolv/res_query.c (__libc_res_nsearch): Protect the debugging
	printf with #ifdef DEBUG and RES_DEBUG check.

--- libc/resolv/res_query.c.jj	2004-08-12 16:38:52.000000000 +0200
+++ libc/resolv/res_query.c	2004-08-12 16:42:09.696933969 +0200
@@ -239,8 +239,11 @@ __libc_res_nsearch(res_state statp,
 		return (__libc_res_nquery(statp, cp, class, type, answer,
 					  anslen, answerp));
 
-	printf("dots=%d, statp->ndots=%d, trailing_dot=%d, name=%s\n",
-	       (int)dots,(int)statp->ndots,(int)trailing_dot,name);
+#ifdef DEBUG
+	if (statp->options & RES_DEBUG)
+		printf("dots=%d, statp->ndots=%d, trailing_dot=%d, name=%s\n",
+		       (int)dots,(int)statp->ndots,(int)trailing_dot,name);
+#endif
 
 	/*
 	 * If there are enough dots in the name, let's just give it a

	Jakub



More information about the Libc-hacker mailing list