summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2024-05-22 12:02:42 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2024-05-22 12:02:42 -0500
commitf1820a1b8df759249fac03f7586ee28eb82155ea (patch)
tree45e49268eb52b41f5a0050c9cbf7db6fdb8c5faf
parent4a8a6aeee88240e35bd14a78cf6dc7efa67f7ffd (diff)
downloadhorizon-awilfox/image-fixes.tar.gz
horizon-awilfox/image-fixes.tar.bz2
horizon-awilfox/image-fixes.tar.xz
horizon-awilfox/image-fixes.zip
image: ISO backend: Bail out on umount failureawilfox/image-fixes
Only if the error is EBUSY - which implies there *is* a filesystem mounted at the specified path - we treat umount as an error and stop. This should prevent /dev from being erased host-side.
-rw-r--r--image/backends/iso.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/image/backends/iso.cc b/image/backends/iso.cc
index 00f5ae4..18dc23e 100644
--- a/image/backends/iso.cc
+++ b/image/backends/iso.cc
@@ -203,8 +203,12 @@ public:
*/
for(const std::string mount : {"dev", "proc", "sys"}) {
const std::string path = this->ir_dir + "/target/" + mount;
- if(::umount(path.c_str()) == EBUSY) {
- run_command("umount", {"-R", path});
+ if(::umount(path.c_str()) == -1) {
+ if(errno == EBUSY &&
+ run_command("umount", {"-R", path}) != 0) {
+ output_error("CD backend", "could not umount " + path);
+ return FS_ERROR;
+ }
}
}
fs::remove_all(this->ir_dir, ec);