db845c: qcom: tqftpserv: Use /data/vendor for temporary files
On AOSP, /tmp is not available. Use /data/vendor instead
for temporary files.
Change-Id: I1d6ebd669573b3c3134e6da943ea9355ed83a3fe
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
diff --git a/qcom/tqftpserv/translate.c b/qcom/tqftpserv/translate.c
index e95dee5..15df6d8 100644
--- a/qcom/tqftpserv/translate.c
+++ b/qcom/tqftpserv/translate.c
@@ -45,7 +45,13 @@
#define READONLY_PATH "/readonly/firmware/image/"
#define READWRITE_PATH "/readwrite/"
+#ifndef ANDROID
#define FIRMWARE_BASE "/lib/firmware/"
+#define TQFTPSERV_TMP "/tmp/tqftpserv"
+#else
+#define FIRMWARE_BASE "/vendor/firmware/"
+#define TQFTPSERV_TMP "/data/vendor/tmp/tqftpserv"
+#endif
/**
* translate_readonly() - open "file" residing with remoteproc firmware
@@ -142,15 +148,15 @@
int ret;
int fd;
- ret = mkdir("/tmp/tqftpserv", 0700);
+ ret = mkdir(TQFTPSERV_TMP, 0700);
if (ret < 0 && errno != EEXIST) {
- warn("failed to create /tmp/tqftpserv");
+ warn("failed to create temporary tqftpserv directory");
return -1;
}
- base = open("/tmp/tqftpserv", O_RDONLY | O_DIRECTORY);
+ base = open(TQFTPSERV_TMP, O_RDONLY | O_DIRECTORY);
if (base < 0) {
- warn("failed top open /tmp/tqftpserv");
+ warn("failed top open temporary tqftpserv directory");
return -1;
}