From bb774d0996cbea04367ac6376691eedcb7b6a4ed Mon Sep 17 00:00:00 2001 From: Alessio Balsini Date: Tue, 21 Jan 2020 23:34:39 +0000 Subject: Use default path if DSU install dir file does not exit ReadFileToString clears the contents of the destination container, then appends it the contents of the requested file. If the file does not exits, then the destination container remains empty. Use the default in_data_dir value if the file access fails. Test: manual OTA Change-Id: I81fca845e7ce769ad750f5e1b6df6563d5334a69 Signed-off-by: Alessio Balsini --- gsi_service.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gsi_service.cpp b/gsi_service.cpp index 8a77f4f..9b74502 100644 --- a/gsi_service.cpp +++ b/gsi_service.cpp @@ -640,7 +640,9 @@ binder::Status GsiService::openImageService(const std::string& prefix, auto in_data_dir = kImageDataPrefix + prefix; auto install_dir_file = DsuInstallDirFile(GetDsuSlot(prefix)); - if (android::base::ReadFileToString(install_dir_file, &in_data_dir)) { + std::string in_data_dir_tmp; + if (android::base::ReadFileToString(install_dir_file, &in_data_dir_tmp)) { + in_data_dir = in_data_dir_tmp; LOG(INFO) << "load " << install_dir_file << ":" << in_data_dir; } std::string metadata_dir, data_dir; -- cgit v1.2.3