--- nono/host/diskimage_raw.cpp 2026/04/29 17:05:11 1.1.1.3 +++ nono/host/diskimage_raw.cpp 2026/04/29 17:05:22 1.1.1.4 @@ -30,6 +30,21 @@ DiskImageRaw::~DiskImageRaw() bool DiskImageRaw::GetInfo(off_t *sizep, bool *w_ok) { + // ファイルのパーミッション + int r = access(pathname.c_str(), W_OK); + if (r == 0) { + *w_ok = true; + } else if (errno == EACCES) { + *w_ok = false; + } else { + if (errno == ENOENT) { + warn("%s", pathname.c_str()); + } else { + warn("%s: access failed", pathname.c_str()); + } + return false; + } + // ファイルサイズは未取得なら取得 if (filesize == (off_t)-1) { struct stat st; @@ -42,17 +57,6 @@ DiskImageRaw::GetInfo(off_t *sizep, bool } *sizep = filesize; - // ファイルのパーミッション - int r = access(pathname.c_str(), W_OK); - if (r == 0) { - *w_ok = true; - } else if (errno == EACCES) { - *w_ok = false; - } else { - warn("%s: access failed", pathname.c_str()); - return false; - } - return true; }