aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-05-02 04:36:41 -0700
committerAndroid Code Review <code-review@android.com>2011-05-02 04:36:41 -0700
commit5c1dcb21388749d6aa45eb92bca79c5ae5b0a929 (patch)
tree7e65bd35c13dd5d21421cdc214740da81ee7b440
parentec1d38fbb171c45fc8b79734efb80e2c21db6ef8 (diff)
parentc0e96f0ec192eff4b36574f703e62030da028bbf (diff)
downloadexternal_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.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 );