-/* 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
int
__internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
struct __netgrent *datap,
- char *buffer, size_t buflen)
+ 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_r (hostp, userp, domainp, &dataset,
- buffer, buflen);
+ buffer, buflen, __errno_location ());
__libc_lock_unlock (lock);