mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 00:13:08 +00:00
Improve error checks on posix_unlink
Just because a file isn't opened doesn't mean the file doesn't exist. Fixes the error returned if host_path.empty(), and removes the error return for when GetFile fails.
This commit is contained in:
parent
6d19a8ec0c
commit
81e9a547ec
@ -933,7 +933,7 @@ s32 PS4_SYSV_ABI posix_unlink(const char* path) {
|
|||||||
bool ro = false;
|
bool ro = false;
|
||||||
const auto host_path = mnt->GetHostPath(path, &ro);
|
const auto host_path = mnt->GetHostPath(path, &ro);
|
||||||
if (host_path.empty()) {
|
if (host_path.empty()) {
|
||||||
*__Error() = POSIX_EACCES;
|
*__Error() = POSIX_ENOENT;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -949,8 +949,8 @@ s32 PS4_SYSV_ABI posix_unlink(const char* path) {
|
|||||||
|
|
||||||
auto* file = h->GetFile(host_path);
|
auto* file = h->GetFile(host_path);
|
||||||
if (file == nullptr) {
|
if (file == nullptr) {
|
||||||
*__Error() = POSIX_ENOENT;
|
// Cannot unlink an unopened file
|
||||||
return -1;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
file->f.Unlink();
|
file->f.Unlink();
|
||||||
|
Loading…
Reference in New Issue
Block a user