void DirBackendAddFixedSize::AddSubsessionFinalize (const fs::path& tmpdir_path, const fs::path& subsession_path, int uid, int gid) const
{
// XXX keep mounts! it should be possible to reuse this dir too!
+ // XXX this is pointless step, need to introduce mount --move
// umount_and_remove(tmpdir_path);
+ if (OS::is_mountpoint(tmpdir_path))
+ do_umount(tmpdir_path);
const auto image_path = DirBackendFixedSize::GetImagePathFromSubsessionPath(subsession_path);
- auto temp_image_path = image_path;
- temp_image_path.replace_filename(TMP_NEW_PREFIX + image_path.filename().native());
- LOGI("rename %s %s", temp_image_path.data(), image_path.data());
- fs::rename(temp_image_path, image_path);
+ auto tmp_image_path = image_path;
+ tmp_image_path.replace_filename(TMP_NEW_PREFIX + image_path.filename().native());
/* The image file (as opposed to the FS inside it) doesn't
* really need any rights, and maybe it would even be better
* if it was harder to disrupt. This way all three concepts,
* i.e. the image, the mount dir, and the FS root, are all
* consistent with their rights though. */
- OS::change_owner_and_group(image_path, uid, gid);
+ //LOGI("change_owner_and_group %s %s", tmp_image_path.c_str(), image_path.c_str());
+ OS::change_owner_and_group(tmp_image_path, uid, gid);
/* Order matters - handle .img first and the directory last,
* since all other logic assumes that the existence of the dir
* signifies that a valid subsession exists. */
//fs::create_directory(subsession_path);
+
+ //LOGI("rename %s %s", tmp_image_path.c_str(), image_path.c_str());
+ fs::rename(tmp_image_path, image_path);
+ //LOGI("rename %s %s", tmpdir_path.c_str(), subsession_path.c_str());
fs::rename(tmpdir_path, subsession_path);
/* The mountpoint's properties don't actually matter, since