--- lib/readline/complete.c +++ lib/readline/complete.c 2011-11-11 13:16:05.635147670 +0000 @@ -83,6 +83,7 @@ typedef int QSFUNC (); defined. */ #if defined (HAVE_GETPWENT) && (!defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE)) extern struct passwd *getpwent PARAMS((void)); +extern void endpwent (); #endif /* HAVE_GETPWENT && (!HAVE_GETPW_DECLS || _POSIX_SOURCE) */ /* If non-zero, then this is the address of a function to call when @@ -2049,12 +2050,12 @@ rl_username_completion_function (text, s break; } #endif +#if defined (HAVE_GETPWENT) + endpwent (); +#endif if (entry == 0) { -#if defined (HAVE_GETPWENT) - endpwent (); -#endif return ((char *)NULL); } else --- lib/readline/shell.c +++ lib/readline/shell.c 2011-11-11 13:14:02.683147026 +0000 @@ -61,9 +61,14 @@ #include "rlshell.h" #include "xmalloc.h" -#if defined (HAVE_GETPWUID) && !defined (HAVE_GETPW_DECLS) +#if !defined (HAVE_GETPW_DECLS) +# if defined (HAVE_GETPWUID) extern struct passwd *getpwuid PARAMS((uid_t)); -#endif /* HAVE_GETPWUID && !HAVE_GETPW_DECLS */ +# endif +# if defined (HAVE_GETPWENT) +extern void endpwent (); +# endif +#endif /* !HAVE_GETPW_DECLS */ #ifndef NULL # define NULL 0 @@ -168,6 +173,9 @@ sh_get_home_dir () if (entry) home_dir = entry->pw_dir; #endif +#if defined (HAVE_GETPWENT) + endpwent (); +#endif return (home_dir); } --- lib/readline/tilde.c +++ lib/readline/tilde.c 2011-11-11 13:09:48.843646721 +0000 @@ -61,6 +61,7 @@ extern struct passwd *getpwuid PARAMS((u # endif # if defined (HAVE_GETPWNAM) extern struct passwd *getpwnam PARAMS((const char *)); +extern void endpwent (); # endif #endif /* !HAVE_GETPW_DECLS */