]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - resolv/gai_misc.c
hurd: Fix build
[thirdparty/glibc.git] / resolv / gai_misc.c
index 2eec0f529d6ee302f204b2849cc9d6faa3bef1f0..69d7086ae67da27736703060d74d4eb2b6650390 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2006 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.
 
@@ -13,9 +13,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <assert.h>
 #include <errno.h>
@@ -153,7 +152,6 @@ get_elem (void)
 
 
 struct requestlist *
-internal_function
 __gai_find_request (const struct gaicb *gaicbp)
 {
   struct requestlist *runp;
@@ -170,7 +168,6 @@ __gai_find_request (const struct gaicb *gaicbp)
 
 
 int
-internal_function
 __gai_remove_request (struct gaicb *gaicbp)
 {
   struct requestlist *runp;
@@ -213,7 +210,6 @@ static void *handle_requests (void *arg);
 /* The main function of the async I/O handling.  It enqueues requests
    and if necessary starts and handles threads.  */
 struct requestlist *
-internal_function
 __gai_enqueue_request (struct gaicb *gaicbp)
 {
   struct requestlist *newp;
@@ -265,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;
@@ -365,7 +364,7 @@ handle_requests (void *arg)
          gettimeofday (&now, NULL);
          wakeup_time.tv_sec = now.tv_sec + optim.gai_idle_time;
          wakeup_time.tv_nsec = now.tv_usec * 1000;
-         if (wakeup_time.tv_nsec > 1000000000)
+         if (wakeup_time.tv_nsec >= 1000000000)
            {
              wakeup_time.tv_nsec -= 1000000000;
              ++wakeup_time.tv_sec;