diff options
-rw-r--r-- | image/backends/iso.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/image/backends/iso.cc b/image/backends/iso.cc index 00f5ae4..9be8029 100644 --- a/image/backends/iso.cc +++ b/image/backends/iso.cc @@ -203,8 +203,14 @@ 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 EBUSY, it will remain mounted when we fs::remove_all + * which will affect the host's environment. Bail out. */ + 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); |