Skip to content

Commit

Permalink
[daemon] fix the compiler warning which caused the build failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeliao committed Oct 20, 2023
1 parent 14035ad commit d8739fd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/daemon/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2489,7 +2489,10 @@ void mp::Daemon::clone(const CloneRequest* request,
const std::string mount_command = fmt::format("mount -o loop {} {}",
cloud_init_config_iso_file_path.string(),
cloud_init_mount_point.string());
std::system(mount_command.c_str());
if (int return_code = std::system(mount_command.c_str()); return_code != 0)
{
throw std::runtime_error{fmt::format("Error executing command : {} ", mount_command)};
}

// load files and add to qemu_iso and write to the .iso file
for (const auto filename_str : {"user-data", "vendor-data"})
Expand All @@ -2504,7 +2507,10 @@ void mp::Daemon::clone(const CloneRequest* request,

// sudo umount /root/.local/share/multipassd/vault/instances/adaptive-cat-clone/cidata
const std::string unmount_command = fmt::format("umount {}", cloud_init_mount_point.string());
std::system(unmount_command.c_str());
if (int return_code = std::system(unmount_command.c_str()); return_code != 0)
{
throw std::runtime_error{fmt::format("Error executing command : {} ", unmount_command)};
}

// delete the created mount folder
if (std::error_code err; !MP_FILEOPS.remove(cloud_init_mount_point, err))
Expand Down

0 comments on commit d8739fd

Please sign in to comment.