Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142992868
D52527.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D52527.id.diff
View Options
diff --git a/bin/sh/dot.profile b/bin/sh/dot.profile
--- a/bin/sh/dot.profile
+++ b/bin/sh/dot.profile
@@ -1,6 +1,4 @@
#
-HOME=/root
-export HOME
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin
export PATH
TERM=${TERM:-xterm}
diff --git a/sbin/init/init.c b/sbin/init/init.c
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -851,9 +851,9 @@
const char *shell;
char *argv[2];
struct timeval tv, tn;
+ struct passwd *pp;
#ifdef SECURE
struct ttyent *typ;
- struct passwd *pp;
static const char banner[] =
"Enter root password, or ^D to go multi-user\n";
char *clear, *password;
@@ -885,6 +885,7 @@
*/
open_console();
+ pp = getpwnam("root");
#ifdef SECURE
/*
* Check the root password.
@@ -892,7 +893,6 @@
* it's the only tty that can be 'off' and 'secure'.
*/
typ = getttynam("console");
- pp = getpwnam("root");
if (typ && (typ->ty_status & TTY_SECURE) == 0 &&
pp && *pp->pw_passwd) {
write_stderr(banner);
@@ -909,7 +909,6 @@
}
}
endttyent();
- endpwent();
#endif /* SECURE */
#ifdef DEBUGSHELL
@@ -930,6 +929,15 @@
}
#endif /* DEBUGSHELL */
+ if (pp != NULL && pp->pw_dir != NULL && *pp->pw_dir != '\0' &&
+ chdir(pp->pw_dir) == 0) {
+ setenv("HOME", pp->pw_dir, 1);
+ } else {
+ chdir("/");
+ setenv("HOME", "/", 1);
+ }
+ endpwent();
+
/*
* Unblock signals.
* We catch all the interesting ones,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 26, 3:36 AM (12 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27997339
Default Alt Text
D52527.id.diff (1 KB)
Attached To
Mode
D52527: init: Use root's home directory in single-user mode
Attached
Detach File
Event Timeline
Log In to Comment