aboutsummaryrefslogtreecommitdiffstats
path: root/android/utils
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-05-02 13:29:14 +0200
committerDavid 'Digit' Turner <digit@android.com>2011-05-02 13:29:14 +0200
commitc0e96f0ec192eff4b36574f703e62030da028bbf (patch)
tree7e65bd35c13dd5d21421cdc214740da81ee7b440 /android/utils
parentec1d38fbb171c45fc8b79734efb80e2c21db6ef8 (diff)
downloadexternal_qemu-c0e96f0ec192eff4b36574f703e62030da028bbf.zip
external_qemu-c0e96f0ec192eff4b36574f703e62030da028bbf.tar.gz
external_qemu-c0e96f0ec192eff4b36574f703e62030da028bbf.tar.bz2
Use user-specific directory for temporary files.
Instead of use /tmp/android/, use /tmp/android-$USER/ so that several users can run the emulator easily on the same system. Change-Id: Ifda1b773cc87a9e0d4ff7e256b74a3f93377d73a
Diffstat (limited to 'android/utils')
-rw-r--r--android/utils/bufprint.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/android/utils/bufprint.c b/android/utils/bufprint.c
index e3aa63c..4626a0f 100644
--- a/android/utils/bufprint.c
+++ b/android/utils/bufprint.c
@@ -147,7 +147,7 @@ bufprint_app_dir(char* buff, char* end)
len = sizeof(appDir)-1;
appDir[len] = 0;
}
-
+
sep = strrchr(appDir, '\\');
if (sep)
*sep = 0;
@@ -215,9 +215,15 @@ bufprint_temp_dir(char* buff, char* end)
return bufprint(buff, end, "%s", path);
#else
+ char path[MAX_PATH];
const char* tmppath = getenv("ANDROID_TMP");
if (!tmppath) {
- tmppath = "/tmp/android";
+ const char* user = getenv("USER");
+ if (user == NULL || user[0] == '\0')
+ user = "unknown";
+
+ snprintf(path, sizeof path, "/tmp/android-%s", user);
+ tmppath = path;
}
mkdir(tmppath, 0744);
return bufprint(buff, end, "%s", tmppath );