summary refs log tree commit diff
path: root/resolv/res_mkquery.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-09-04 18:00:58 +0000
committerUlrich Drepper <drepper@redhat.com>2006-09-04 18:00:58 +0000
commit03eeff83892d66bd06f85eab3172ab4679273f6e (patch)
tree7498f2698a21722864477296bb1868c45cee2284 /resolv/res_mkquery.c
parentb80770b23f7c285fb7c04e3e86dc5f2bb2a1cf11 (diff)
downloadglibc-03eeff83892d66bd06f85eab3172ab4679273f6e.tar.gz
glibc-03eeff83892d66bd06f85eab3172ab4679273f6e.tar.xz
glibc-03eeff83892d66bd06f85eab3172ab4679273f6e.zip
* resolv/res_mkquery.c (res_nmkquery): Set hp->id to statp->id after
	randomization rather than before.
	* resolv/res_init.c (res_randomid): Don't call gettimeofday here.
Diffstat (limited to 'resolv/res_mkquery.c')
-rw-r--r--resolv/res_mkquery.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
index 4d98b8c5e8..fd80569fe2 100644
--- a/resolv/res_mkquery.c
+++ b/resolv/res_mkquery.c
@@ -124,24 +124,20 @@ res_nmkquery(res_state statp,
 	   incremented by one after the initial randomization which
 	   still predictable if the application does multiple
 	   requests.  */
-#if 0
-	hp->id = htons(++statp->id);
-#else
-	hp->id = htons(statp->id);
 	int randombits;
 	do
 	  {
-# ifdef RANDOM_BITS
+#ifdef RANDOM_BITS
 	    RANDOM_BITS (randombits);
-# else
+#else
 	    struct timeval tv;
 	    __gettimeofday (&tv, NULL);
 	    randombits = (tv.tv_sec << 8) ^ tv.tv_usec;
-# endif
+#endif
 	  }
 	while ((randombits & 0xffff) == 0);
 	statp->id = (statp->id + randombits) & 0xffff;
-#endif
+	hp->id = statp->id;
 	hp->opcode = op;
 	hp->rd = (statp->options & RES_RECURSE) != 0;
 	hp->rcode = NOERROR;