Skip to content

Commit 2b4592b

Browse files
authored
Fix incorrect error return on attempting to create a file in a nonexistent folder in a writable mount (#4952)
I refuse to have a clang commit on a one line fix PR, so a force push it is.
1 parent 1403d31 commit 2b4592b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/core/libraries/kernel/file_system.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ s32 PS4_SYSV_ABI open(const char* raw_path, s32 flags, u16 mode) {
237237
file->handle = mnt->Open(file->m_guest_name, access_mode);
238238
if (!file->handle || !file->handle->IsOpen()) {
239239
h->DeleteHandle(handle);
240-
*__Error() = (write || rdwr || truncate) ? POSIX_EROFS : POSIX_EIO;
240+
*__Error() = (write || rdwr || truncate) && mnt->GetMount(raw_path)->read_only
241+
? POSIX_EROFS
242+
: POSIX_EIO;
241243
LOG_ERROR(Kernel_Fs, "Opening {} failed, backend did not serve the file", raw_path);
242244
return -1;
243245
}

0 commit comments

Comments
 (0)