diff options
author | David 'Digit' Turner <digit@android.com> | 2011-05-02 04:36:41 -0700 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2011-05-02 04:36:41 -0700 |
commit | 5c1dcb21388749d6aa45eb92bca79c5ae5b0a929 (patch) | |
tree | 7e65bd35c13dd5d21421cdc214740da81ee7b440 | |
parent | ec1d38fbb171c45fc8b79734efb80e2c21db6ef8 (diff) | |
parent | c0e96f0ec192eff4b36574f703e62030da028bbf (diff) | |
download | external_qemu-5c1dcb21388749d6aa45eb92bca79c5ae5b0a929.zip external_qemu-5c1dcb21388749d6aa45eb92bca79c5ae5b0a929.tar.gz external_qemu-5c1dcb21388749d6aa45eb92bca79c5ae5b0a929.tar.bz2 |
Merge "Use user-specific directory for temporary files."
-rw-r--r-- | android/utils/bufprint.c | 10 |
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 ); |