summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-04-28 23:17:44 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-04-28 23:17:44 +0000
commit17d1892d006a4735ad580088f325961eab5a322b (patch)
tree2b73692324ec5d8c361048ea46a94d005ab94757
parent66c6ffe0ade8f756c4d3ba48e80203aaf1ab0e33 (diff)
Make the -H option work again.
-rw-r--r--usr.bin/sudo/sudo.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/sudo/sudo.c b/usr.bin/sudo/sudo.c
index 4c6d3e34026..032cdf162d1 100644
--- a/usr.bin/sudo/sudo.c
+++ b/usr.bin/sudo/sudo.c
@@ -342,14 +342,10 @@ main(argc, argv)
exit(0);
}
- /* Set $HOME for `sudo -H' */
- if ((sudo_mode & MODE_RESET_HOME) && runas_homedir)
- (void) sudo_setenv("HOME", runas_homedir);
-
/* This *must* have been set if we got a match but... */
if (safe_cmnd == NULL) {
log_error(MSG_ONLY,
- "internal error, cmnd_safe never got set for %s; %s",
+ "internal error, safe_cmnd never got set for %s; %s",
user_cmnd,
"please report this error at http://courtesan.com/sudo/bugs/");
}
@@ -384,6 +380,10 @@ main(argc, argv)
/* Become specified user or root. */
set_perms(PERM_RUNAS, sudo_mode);
+ /* Set $HOME for `sudo -H'. Only valid at PERM_RUNAS. */
+ if ((sudo_mode & MODE_RESET_HOME) && runas_homedir)
+ (void) sudo_setenv("HOME", runas_homedir);
+
#ifndef PROFILING
if ((sudo_mode & MODE_BACKGROUND) && fork() > 0)
exit(0);