$Id$ Fix the _XGetpwnam macro to be more consistent; this patch by Robert Millan. diff -ruN xc-old/include/Xos_r.h xc/include/Xos_r.h --- xc-old/include/Xos_r.h 2004-04-23 18:43:05.000000000 +0000 +++ xc/include/Xos_r.h 2004-10-26 05:45:59.432421400 +0000 @@ -217,8 +217,8 @@ * * typedef ... _Xgetpwparams; * - * struct passwd* _XGetpwnam(const char *name, _Xgetpwparams); - * struct passwd* _XGetpwuid(uid_t uid, _Xgetpwparams); + * struct passwd* _XGetpwnam(const char *name, _Xgetpwparams, struct **dummy); + * struct passwd* _XGetpwuid(uid_t uid, _Xgetpwparams, struct **dummy); */ #if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H) @@ -238,8 +238,8 @@ extern struct passwd *getpwuid(), *getpwnam(); # endif typedef int _Xgetpwparams; /* dummy */ -# define _XGetpwuid(u,p) getpwuid((u)) -# define _XGetpwnam(u,p) getpwnam((u)) +# define _XGetpwuid(u,p,s) getpwuid((u)) +# define _XGetpwnam(u,p,s) getpwnam((u)) #elif !defined(XOS_USE_MTSAFE_PWDAPI) || defined(XNO_MTSAFE_PWDAPI) /* UnixWare 2.0, or other systems with thread support but no _r API. */ @@ -316,12 +316,12 @@ ((p).pwp = &(p).pws), \ 0 ) #endif -# define _XGetpwuid(u,p) \ +# define _XGetpwuid(u,p,s) \ ( (_Xos_processLock), \ (((p).pwp = getpwuid((u))) ? _Xpw_copyPasswd(p), 0 : 0), \ (_Xos_processUnlock), \ (p).pwp ) -# define _XGetpwnam(u,p) \ +# define _XGetpwnam(u,p,s) \ ( (_Xos_processLock), \ (((p).pwp = getpwnam((u))) ? _Xpw_copyPasswd(p), 0 : 0), \ (_Xos_processUnlock), \ @@ -336,21 +336,21 @@ } _Xgetpwparams; # if defined(_POSIX_REENTRANT_FUNCTIONS) || !defined(SVR4) || defined(Lynx) # ifndef Lynx -# define _XGetpwuid(u,p) \ -((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) -# define _XGetpwnam(u,p) \ -((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) +# define _XGetpwuid(u,p,s) \ +((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),(s)) == -1) ? NULL : &(p).pws) +# define _XGetpwnam(u,p,s) \ +((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),(s)) == -1) ? NULL : &(p).pws) # else /* Lynx */ -# define _XGetpwuid(u,p) \ -((getpwuid_r(&(p).pws,(u),(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) -# define _XGetpwnam(u,p) \ -((getpwnam_r(&(p).pws,(u),(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) +# define _XGetpwuid(u,p,s) \ +((getpwuid_r(&(p).pws,(u),(p).pwbuf,sizeof((p).pwbuf),(s)) == -1) ? NULL : &(p).pws) +# define _XGetpwnam(u,p,s) \ +((getpwnam_r(&(p).pws,(u),(p).pwbuf,sizeof((p).pwbuf),(s)) == -1) ? NULL : &(p).pws) # endif # else /* SVR4 */ -# define _XGetpwuid(u,p) \ -((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws) -# define _XGetpwnam(u,p) \ -((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws) +# define _XGetpwuid(u,p,s) \ +((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),(s)) == NULL) ? NULL : &(p).pws) +# define _XGetpwnam(u,p,s) \ +((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),(s)) == NULL) ? NULL : &(p).pws) # endif /* SVR4 */ #else /* _POSIX_THREAD_SAFE_FUNCTIONS */ @@ -367,10 +367,10 @@ struct passwd* pwp; } _Xgetpwparams; typedef int _Xgetpwret; -# define _XGetpwuid(u,p) \ +# define _XGetpwuid(u,p,s) \ ((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == -1) ? \ NULL : (p).pwp) -# define _XGetpwnam(u,p) \ +# define _XGetpwnam(u,p,s) \ ((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == -1) ? \ NULL : (p).pwp) #endif /* X_INCLUDE_PWD_H */ diff -ruN xc-old/lib/X11/GetDflt.c xc/lib/X11/GetDflt.c --- xc-old/lib/X11/GetDflt.c 2004-04-23 18:43:23.000000000 +0000 +++ xc/lib/X11/GetDflt.c 2004-10-26 05:45:59.435420944 +0000 @@ -126,10 +126,11 @@ (void) strncpy(dest, ptr, len-1); dest[len-1] = '\0'; } else { + struct passwd *dummy; if ((ptr = getenv("USER"))) - pw = _XGetpwnam(ptr,pwparams); + pw = _XGetpwnam(ptr,pwparams,&dummy); else - pw = _XGetpwuid(getuid(),pwparams); + pw = _XGetpwuid(getuid(),pwparams,&dummy); if (pw != NULL) { (void) strncpy(dest, pw->pw_dir, len-1); dest[len-1] = '\0'; diff -ruN xc-old/lib/Xp/XpJob.c xc/lib/Xp/XpJob.c --- xc-old/lib/Xp/XpJob.c 2004-04-23 18:43:46.000000000 +0000 +++ xc/lib/Xp/XpJob.c 2004-10-26 05:50:19.246923592 +0000 @@ -105,7 +105,8 @@ _Xgetpwparams pwparams; #endif struct passwd *pw; - pw = _XGetpwuid(getuid(),pwparams); + struct passwd *dummy; + pw = _XGetpwuid(getuid(),pwparams,&dummy); if (pw && (PwName = pw->pw_name)) { #else diff -ruN xc-old/lib/Xt/Initialize.c xc/lib/Xt/Initialize.c --- xc-old/lib/Xt/Initialize.c 2004-04-23 18:43:52.000000000 +0000 +++ xc/lib/Xt/Initialize.c 2004-10-26 05:51:16.445228128 +0000 @@ -303,7 +303,8 @@ (void) strncpy (dest, ptr, len-1); dest[len-1] = '\0'; } else { - if ((pw = _XGetpwuid(getuid(),pwparams)) != NULL) { + struct passwd *dummy; + if ((pw = _XGetpwuid(getuid(),pwparams,&dummy)) != NULL) { (void) strncpy (dest, pw->pw_name, len-1); dest[len-1] = '\0'; } else @@ -350,10 +351,11 @@ (void) strncpy (dest, ptr, len-1); dest[len-1] = '\0'; } else { + struct passwd *dummy; if ((ptr = getenv("USER"))) - pw = _XGetpwnam(ptr,pwparams); + pw = _XGetpwnam(ptr,pwparams,&dumy); else - pw = _XGetpwuid(getuid(),pwparams); + pw = _XGetpwuid(getuid(),pwparams,&dummy); if (pw != NULL) { (void) strncpy (dest, pw->pw_dir, len-1); dest[len-1] = '\0';