summaryrefslogtreecommitdiff
path: root/Src/params.c
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2021-09-22 13:36:57 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2021-09-22 13:36:57 +0900
commitdd51ffa5b4b9759af2667df8e4505f117b8e2b23 (patch)
treef54d284d8fd25e571e53b139fa9829c101fe5b37 /Src/params.c
parentdb46c9cd5844240fb6015666c8e2a12a0a3a6ead (diff)
downloadzsh-dd51ffa5b4b9759af2667df8e4505f117b8e2b23.tar.gz
zsh-dd51ffa5b4b9759af2667df8e4505f117b8e2b23.zip
49422: improve support of --disable-dynamic-nss
see also 49392 (Vincent) and 49412 (Axel)
Diffstat (limited to 'Src/params.c')
-rw-r--r--Src/params.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/Src/params.c b/Src/params.c
index 4f6b361f9..704aad588 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -843,9 +843,12 @@ createparamtable(void)
setsparam("HOST", ztrdup_metafy(hostnam));
zfree(hostnam, 256);
- setsparam("LOGNAME",
- ztrdup_metafy((str = getlogin()) && *str ?
- str : cached_username));
+ setsparam("LOGNAME", ztrdup_metafy(
+#ifndef DISABLE_DYNAMIC_NSS
+ (str = getlogin()) && *str ? str :
+#endif
+ cached_username
+ ));
#if !defined(HAVE_PUTENV) && !defined(USE_SET_UNSET_ENV)
/* Copy the environment variables we are inheriting to dynamic *
@@ -4430,7 +4433,7 @@ usernamegetfn(UNUSED(Param pm))
void
usernamesetfn(UNUSED(Param pm), char *x)
{
-#if defined(HAVE_SETUID) && defined(HAVE_GETPWNAM)
+#if defined(HAVE_SETUID) && defined(USE_GETPWNAM)
struct passwd *pswd;
if (x && (pswd = getpwnam(x)) && (pswd->pw_uid != cached_uid)) {
@@ -4447,7 +4450,7 @@ usernamesetfn(UNUSED(Param pm), char *x)
cached_uid = pswd->pw_uid;
}
}
-#endif /* HAVE_SETUID && HAVE_GETPWNAM */
+#endif /* HAVE_SETUID && USE_GETPWNAM */
zsfree(x);
}