--- nono/host/diskimage.cpp 2026/04/29 17:05:00 1.1.1.2 +++ nono/host/diskimage.cpp 2026/04/29 17:05:26 1.1.1.5 @@ -36,12 +36,10 @@ DiskImage::CreateHandler(const std::stri cow_enable = false; // 今の所 Raw しかない - try { - driver.reset(new DiskImageRaw(pathname)); + driver.reset(new DiskImageRaw(pathname)); + if ((bool)driver) { return true; - } catch (...) { } - return false; } @@ -91,7 +89,7 @@ DiskImage::Open(bool read_only, bool cow assert(cowname.empty() == false); cowname = gMainApp.GetVMDir() + "/." + cowname + ".cow"; - cowfd = open(cowname.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0644); + cowfd = open(cowname.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0600); if (cowfd < 0) { return false; } @@ -132,7 +130,7 @@ DiskImage::Read(void *buf, off_t offset, { assert((bool)driver); - if (__predict_false(offset + size >= GetSize())) { + if (__predict_false(offset + size > GetSize())) { return false; } @@ -178,7 +176,7 @@ DiskImage::Write(const void *buf, off_t { assert((bool)driver); - if (__predict_false(offset + size >= GetSize())) { + if (__predict_false(offset + size > GetSize())) { return false; }