-/* Copyright (c) 1998 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
#include <limits.h>
#include <stdlib.h>
#include <string.h>
+#include <arpa/inet.h>
#include <rpcsvc/nis.h>
#include <sys/param.h>
#include <sys/stat.h>
must be invalidated and remember them. Then we get the lock and
actually remove them. This is complicated by the way we have to
free the data structures since some hash table entries share the same
- data.
-
- This function must be called with the write-lock held. */
+ data. */
void
prune_cache (struct database *table, time_t now)
{
struct hashentry *old = head;
if (debug_level > 0)
- dbg_log ("remove %s entry \"%s\"",
- serv2str[old->type],
- old->last
- ? old->key : old->data == (void *) -1 ? old->key : "???");
+ {
+ char buf[INET6_ADDRSTRLEN];
+ const char *str;
+
+ if ((old->type == GETHOSTBYADDR || old->type == GETHOSTBYADDRv6)
+ && (old->last || old->data == (void *) -1))
+ {
+ inet_ntop (old->type == GETHOSTBYADDR ? AF_INET : AF_INET6,
+ old->key, buf, sizeof (buf));
+ str = buf;
+ }
+ else
+ str = old->last ? old->key : (old->data == (void *) -1
+ ? old->key : "???");
+
+ dbg_log ("remove %s entry \"%s\"", serv2str[old->type], str);
+ }
/* Free the data structures. */
if (old->data == (void *) -1)