From 173eb396c7854a3b6c18d0d65865ad05c8b0e195 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Mon, 7 Dec 2015 15:17:56 -0800 Subject: [PATCH] adb: Make HOME=/data/local/tmp Make the home directory for adb shell be /data/local/tmp and automatically change into that directory. Change-Id: Ib5cc6e1ecdd31a37e986cf03836f7589ebd40868 --- adb/shell_service.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adb/shell_service.cpp b/adb/shell_service.cpp index 3fc70b026..6c066694d 100644 --- a/adb/shell_service.cpp +++ b/adb/shell_service.cpp @@ -289,7 +289,6 @@ bool Subprocess::ForkAndExec() { // TODO: $HOSTNAME? Normally bash automatically sets that, but mksh doesn't. passwd* pw = getpwuid(getuid()); if (pw != nullptr) { - setenv("HOME", pw->pw_dir, 1); setenv("LOGNAME", pw->pw_name, 1); setenv("SHELL", pw->pw_shell, 1); setenv("USER", pw->pw_name, 1); @@ -298,6 +297,8 @@ bool Subprocess::ForkAndExec() { setenv("TERM", terminal_type_.c_str(), 1); } + setenv("HOME", "/data/local/tmp", 1); + chdir(getenv("HOME")); if (is_interactive()) { execl(_PATH_BSHELL, _PATH_BSHELL, "-", nullptr); } else {