diff options
author | ache <ache@FreeBSD.org> | 1997-02-27 05:09:58 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-02-27 05:09:58 +0000 |
commit | 2d211f6dadbab87e058b87d6cf7efb0d933ea228 (patch) | |
tree | 6e15501c2b374536e4b1a0da7d96ca833735f12c /usr.bin/login/login.c | |
parent | fcbba57d1668354b89474e87fb5b735721a3646b (diff) | |
download | FreeBSD-src-2d211f6dadbab87e058b87d6cf7efb0d933ea228.zip FreeBSD-src-2d211f6dadbab87e058b87d6cf7efb0d933ea228.tar.gz |
Back out "shell" / pw_shell change, I was confused by the same
variable name (with different functionality)
Diffstat (limited to 'usr.bin/login/login.c')
-rw-r--r-- | usr.bin/login/login.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index c6ff4db..affb3c5 100644 --- a/usr.bin/login/login.c +++ b/usr.bin/login/login.c @@ -582,8 +582,6 @@ main(argc, argv) strncpy(shell, pwd->pw_shell, sizeof shell); #endif /* LOGIN_CAP */ shell[sizeof shell - 1] = '\0'; - if (*shell == '\0') - strcpy(shell, _PATH_BSHELL); #ifdef LOGIN_ACCESS if (login_access(pwd->pw_name, hostname ? full_hostname : tty) == 0) { @@ -661,7 +659,12 @@ main(argc, argv) (void)setuid(rootlogin ? 0 : pwd->pw_uid); #endif - (void)setenv("SHELL", shell, 1); + if (*pwd->pw_shell == '\0') { + pwd->pw_shell = _PATH_BSHELL; + if (*shell == '\0') /* Not overridden */ + strcpy(shell, pwd->pw_shell); + } + (void)setenv("SHELL", pwd->pw_shell, 1); (void)setenv("HOME", pwd->pw_dir, 1); if (term[0] != '\0') (void)setenv("TERM", term, 1); /* Preset overrides */ @@ -713,7 +716,7 @@ main(argc, argv) /* Login shells have a leading '-' in front of argv[0] */ tbuf[0] = '-'; - (void)strcpy(tbuf + 1, (p = strrchr(shell, '/')) ? p + 1 : shell); + (void)strcpy(tbuf + 1, (p = strrchr(pwd->pw_shell, '/')) ? p + 1 : pwd->pw_shell); #ifdef LOGIN_CAP login_close(lc); |