Check if it is mounted before trying mount 19/286319/1
authorilho kim <ilho159.kim@samsung.com>
Wed, 4 Jan 2023 00:20:55 +0000 (09:20 +0900)
committerilho kim <ilho159.kim@samsung.com>
Wed, 4 Jan 2023 00:25:07 +0000 (09:25 +0900)
Due to abnormal termination, the previously mounted path may remain

Change-Id: I20e25de24deae8a4a11e7da506eb8dfb830b0794
Signed-off-by: ilho kim <ilho159.kim@samsung.com>
src/common/tzip_interface.cc

index 0ce658e..f215674 100644 (file)
@@ -94,6 +94,12 @@ class TzipInterface::Pimpl {
   bool MountZip(const boost::filesystem::path& zip_path) {
     zip_path_ = zip_path;
 
+    if (IsMounted()) {
+      LOG(WARNING) << "Mount path(" << mount_path_
+          << ") already mounted, try to unmount";
+      UnmountZip();
+    }
+
     if (bf::exists(mount_path_)) {
       LOG(WARNING) << "Mount path(" << mount_path_ << ") already exists! "
                    << "We will remove it...";