Merge "Stable working directory for vm_demo_native app" into main am: 231f543329
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/3392419
Change-Id: Ibaa84e92978a49915265912efb8c160b1f3e588c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/android/vm_demo_native/main.cpp b/android/vm_demo_native/main.cpp
index d7ff02e..e1acc05 100644
--- a/android/vm_demo_native/main.cpp
+++ b/android/vm_demo_native/main.cpp
@@ -361,8 +361,10 @@
// This is the main routine that follows the steps in order
Result<void> inner_main() {
- TemporaryDir work_dir;
- std::string work_dir_path(work_dir.path);
+ std::string work_dir_path("/data/local/tmp/vm_demo/");
+ if (mkdir(work_dir_path.c_str(), 0700) == -1 && errno != EEXIST) {
+ return ErrnoError() << "failed to create working directory " << work_dir_path.c_str();
+ }
// Step 1: connect to the virtualizationservice
unique_fd fd = OR_RETURN(get_service_fd());