-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
+#include <errno.h>
#include <netdb.h>
#include <stdlib.h>
#include <string.h>
}
\f
static int
-__internal_setnetgrent_reuse (const char *group, struct __netgrent *datap)
+internal_function
+__internal_setnetgrent_reuse (const char *group, struct __netgrent *datap,
+ int *errnop)
{
enum nss_status (*fct) (const char *, struct __netgrent *);
enum nss_status status = NSS_STATUS_UNAVAIL;
{
if (new_elem != NULL)
free (new_elem);
- status = NSS_STATUS_UNAVAIL;
+ *errnop = errno;
+ status = NSS_STATUS_TRYAGAIN;
}
else
{
/* Free list of all netgroup names from last run. */
free_memory (datap);
- return __internal_setnetgrent_reuse (group, datap);
+ return __internal_setnetgrent_reuse (group, datap, __errno_location ());
}
int
/* Remember which was the last used service. */
old_nip = nip;
- /* Cycle through all the services and run their setnetgrent functions. */
+ /* Cycle through all the services and run their endnetgrent functions. */
no_more = setup ((void **) &fct, "endnetgrent", 1);
while (! no_more)
{
int
-__internal_getnetgrent (char **hostp, char **userp, char **domainp,
- struct __netgrent *datap,
- char *buffer, size_t buflen)
+__internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
+ struct __netgrent *datap,
+ char *buffer, size_t buflen, int *errnop)
{
enum nss_status (*fct) (struct __netgrent *, char *, size_t);
int no_more;
datap->known_groups = tmp;
found = __internal_setnetgrent_reuse (datap->known_groups->name,
- datap);
+ datap, errnop);
}
if (found)
__libc_lock_lock (lock);
- status = __internal_getnetgrent (hostp, userp, domainp, &dataset,
- buffer, buflen);
+ status = __internal_getnetgrent_r (hostp, userp, domainp, &dataset,
+ buffer, buflen, __errno_location ());
__libc_lock_unlock (lock);