diff options
Diffstat (limited to 'contrib/bind/lib/irs/getpwent_r.c')
-rw-r--r-- | contrib/bind/lib/irs/getpwent_r.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/contrib/bind/lib/irs/getpwent_r.c b/contrib/bind/lib/irs/getpwent_r.c index 761fa45..ee2d8a7 100644 --- a/contrib/bind/lib/irs/getpwent_r.c +++ b/contrib/bind/lib/irs/getpwent_r.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: getpwent_r.c,v 8.3 1999/01/08 19:24:33 vixie Exp $"; +static const char rcsid[] = "$Id: getpwent_r.c,v 8.6 2001/11/01 08:02:15 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include <port_before.h> @@ -27,7 +27,19 @@ static const char rcsid[] = "$Id: getpwent_r.c,v 8.3 1999/01/08 19:24:33 vixie E #include <string.h> #include <stdio.h> #include <sys/types.h> +#if (defined(POSIX_GETPWNAM_R) || defined(POSIX_GETPWUID_R)) +#if defined(_POSIX_PTHREAD_SEMANTICS) + /* turn off solaris remapping in <grp.h> */ +#undef _POSIX_PTHREAD_SEMANTICS #include <pwd.h> +#define _POSIX_PTHREAD_SEMANTICS 1 +#else +#define _UNIX95 1 +#include <pwd.h> +#endif +#else +#include <pwd.h> +#endif #include <port_after.h> #ifdef PASS_R_RETURN @@ -50,7 +62,7 @@ getpwnam_r(const char *login, struct passwd *pwptr, if (pw == NULL) { *result = NULL; - return (-1); + return (0); } res = copy_passwd(pw, pwptr, buf, buflen); @@ -87,7 +99,7 @@ getpwuid_r(uid_t uid, struct passwd *pwptr, if (pw == NULL) { *result = NULL; - return (-1); + return (0); } res = copy_passwd(pw, pwptr, buf, buflen); @@ -142,7 +154,12 @@ setpassent_r(int stayopen) } PASS_R_SET_RETURN -setpwent_r(PASS_R_ENT_ARGS) { +#ifdef PASS_R_ENT_ARGS +setpwent_r(PASS_R_ENT_ARGS) +#else +setpwent_r(void) +#endif +{ setpwent(); #ifdef PASS_R_SET_RESULT @@ -151,7 +168,12 @@ setpwent_r(PASS_R_ENT_ARGS) { } PASS_R_END_RETURN -endpwent_r(PASS_R_ENT_ARGS) { +#ifdef PASS_R_ENT_ARGS +endpwent_r(PASS_R_ENT_ARGS) +#else +endpwent_r(void) +#endif +{ endpwent(); PASS_R_END_RESULT(PASS_R_OK); @@ -177,8 +199,8 @@ fgetpwent_r(FILE *f, struct passwd *pwptr, PASS_R_COPY_ARGS) { static int copy_passwd(struct passwd *pw, struct passwd *pwptr, char *buf, int buflen) { char *cp; - int i, n; - int numptr, len; + int n; + int len; /* Find out the amount of space required to store the answer. */ len = strlen(pw->pw_name) + 1; @@ -192,7 +214,7 @@ copy_passwd(struct passwd *pw, struct passwd *pwptr, char *buf, int buflen) { if (len > buflen) { errno = ERANGE; - return (-1); + return (ERANGE); } /* copy fixed atomic values*/ @@ -248,6 +270,6 @@ copy_passwd(struct passwd *pw, struct passwd *pwptr, char *buf, int buflen) { return (0); } #else /* PASS_R_RETURN */ - static int getpwent_r_unknown_systemm = 0; + static int getpwent_r_unknown_system = 0; #endif /* PASS_R_RETURN */ #endif /* !def(_REENTRANT) || !def(DO_PTHREADS) || !def(WANT_IRS_PW) */ |