aboutsummaryrefslogtreecommitdiffstats
path: root/libc/dns/resolv/res_init.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-07-21 15:31:01 -0700
committerElliott Hughes <enh@google.com>2014-07-21 15:31:53 -0700
commit0f7d882bb7661f9601f3843b0e393b6155cd9571 (patch)
tree223bf8cf085420b06aefb3d8fb3ef0b4bef97e85 /libc/dns/resolv/res_init.c
parent1fb90a8aa0086f7e4f7960a5b916b8605a9a3c96 (diff)
downloadandroid_bionic-0f7d882bb7661f9601f3843b0e393b6155cd9571.tar.gz
android_bionic-0f7d882bb7661f9601f3843b0e393b6155cd9571.tar.bz2
android_bionic-0f7d882bb7661f9601f3843b0e393b6155cd9571.zip
Switch to OpenBSD res_random.
Change-Id: Ia971d647832893e9bb4601697132a105524d2f96
Diffstat (limited to 'libc/dns/resolv/res_init.c')
-rw-r--r--libc/dns/resolv/res_init.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/libc/dns/resolv/res_init.c b/libc/dns/resolv/res_init.c
index f1cbed8ac..ab5db1323 100644
--- a/libc/dns/resolv/res_init.c
+++ b/libc/dns/resolv/res_init.c
@@ -616,47 +616,6 @@ net_mask(struct in_addr in) /*!< XXX - should really use system's version of thi
}
#endif
-#ifdef ANDROID_CHANGES
-static int
-real_randomid(u_int *random_value) {
- /* open the nonblocking random device, returning -1 on failure */
- int random_device = open("/dev/urandom", O_RDONLY | O_CLOEXEC);
- if (random_device < 0) {
- return -1;
- }
-
- /* read from the random device, returning -1 on failure (or too many retries)*/
- for (u_int retry = 5; retry > 0; retry--) {
- int retval = read(random_device, random_value, sizeof(u_int));
- if (retval == sizeof(u_int)) {
- *random_value &= 0xffff;
- close(random_device);
- return 0;
- } else if ((retval < 0) && (errno != EINTR)) {
- break;
- }
- }
-
- close(random_device);
- return -1;
-}
-#endif /* ANDROID_CHANGES */
-
-u_int
-res_randomid(void) {
-#ifdef ANDROID_CHANGES
- int status = 0;
- u_int output = 0;
- status = real_randomid(&output);
- if (status != -1) {
- return output;
- }
-#endif /* ANDROID_CHANGES */
- struct timeval now;
- gettimeofday(&now, NULL);
- return (0xffff & (now.tv_sec ^ now.tv_usec ^ getpid()));
-}
-
/*%
* This routine is for closing the socket if a virtual circuit is used and
* the program wants to close it. This provides support for endhostent()