summaryrefslogtreecommitdiff
path: root/resolv/gai_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'resolv/gai_misc.c')
-rw-r--r--resolv/gai_misc.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/resolv/gai_misc.c b/resolv/gai_misc.c
index e7c3b63cc5..760c33ac29 100644
--- a/resolv/gai_misc.c
+++ b/resolv/gai_misc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <assert.h>
#include <errno.h>
@@ -261,8 +261,11 @@ __gai_enqueue_request (struct gaicb *gaicbp)
/* We cannot create a thread in the moment and there is
also no thread running. This is a problem. `errno' is
set to EAGAIN if this is only a temporary problem. */
- assert (lastp->next == newp);
- lastp->next = NULL;
+ assert (requests == newp || lastp->next == newp);
+ if (lastp != NULL)
+ lastp->next = NULL;
+ else
+ requests = NULL;
requests_tail = lastp;
newp->next = freelist;
@@ -354,13 +357,13 @@ handle_requests (void *arg)
something to arrive in it. */
if (runp == NULL && optim.gai_idle_time >= 0)
{
- struct timeval now;
+ struct timespec now;
struct timespec wakeup_time;
++idle_thread_count;
- gettimeofday (&now, NULL);
+ __clock_gettime (CLOCK_REALTIME, &now);
wakeup_time.tv_sec = now.tv_sec + optim.gai_idle_time;
- wakeup_time.tv_nsec = now.tv_usec * 1000;
+ wakeup_time.tv_nsec = now.tv_nsec;
if (wakeup_time.tv_nsec >= 1000000000)
{
wakeup_time.tv_nsec -= 1000000000;