From ff3cacc50c42290ff76922257247c95f27fa3736 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 10 Sep 2005 03:20:33 +0000 Subject: * inet/getnetgrent_r.c: Include assert. (setup): Remove FUNC_NAME and ALL arguments, assume they are always "setnetgrent" and 1. (endnetgrent_hook): New function. (internal_endnetgrent): Use it. (__internal_setnetgrent_reuse): Use it. Adjust setup caller. If status is NSS_STATUS_SUCCESS, yet action is continue, call endnetgrent hook. (internal_getnetgrent_r): Use __nss_lookup_function rather than setup. Recompute getfct pointer after successful __internal_setnetgrent_reuse. Don't use __nss_next. (innetgr): Use __nss_lookup_function instead of __nss_lookup. Adjust setup caller. * nss/nss_files/files-netgrp.c (_nss_files_endnetgrent): Always clear data_size and cursor. Add libnss_files_hidden_proto and libnss_files_hidden_def. (_nss_files_setnetgrent): Call _nss_files_endnetgrent on failure. * nis/nss_nis/nis-netgrp.c (internal_endnetgrent): Always clear data_size and cursor. (_nss_nis_setnetgrent): Don't call internal_endnetgrent. (_nss_nis_getnetgrent_r): Remove result->cursor == NULL handling. * nis/nss_nisplus/nisplus-netgrp.c (internal_endnetgrent): Always clear data_size and position. (_nss_nisplus_setnetgrent): Don't call internal_endnetgrent. 2005-09-09 Ulrich Drepper * nss/getent.c (netgroup_keys): Call endnetgrent. (main): Call mtrace. * nss/nss_files/files-netgrp.c (_nss_files_setnetgrent): We don't need locking for the stream. Use feof_unlocked. 2005-09-09 Jakub Jelinek --- nss/getent.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'nss/getent.c') diff --git a/nss/getent.c b/nss/getent.c index 7124e6303f..02bba39752 100644 --- a/nss/getent.c +++ b/nss/getent.c @@ -21,22 +21,23 @@ #include #include -#include -#include -#include #include #include +#include #include #include +#include #include +#include +#include #include #include #include -#include -#include -#include #include #include +#include +#include +#include /* Get libc version number. */ #include @@ -410,6 +411,8 @@ netgroup_keys (int number, char *key[]) } } + endnetgrent (); + return result; } @@ -838,7 +841,8 @@ more_help (int key, const char *text, void *input) int main (int argc, char *argv[]) { - int remaining, i; + /* Debugging support. */ + mtrace (); /* Set locale via LC_ALL. */ setlocale (LC_ALL, ""); @@ -846,6 +850,7 @@ main (int argc, char *argv[]) textdomain (PACKAGE); /* Parse and process arguments. */ + int remaining; argp_parse (&argp, argc, argv, 0, &remaining, NULL); if ((argc - remaining) < 1) @@ -855,7 +860,7 @@ main (int argc, char *argv[]) return 1; } - for (i = 0; databases[i].name; ++i) + for (int i = 0; databases[i].name; ++i) if (argv[remaining][0] == databases[i].name[0] && !strcmp (argv[remaining], databases[i].name)) return databases[i].func (argc - remaining - 1, &argv[remaining + 1]); -- cgit v1.2.3