mirror of
https://github.com/par274/sharpemu.git
synced 2026-08-08 18:55:41 +08:00
fix(kernel): finish Posix -1/errno for file ops and open EACCES (#567)
Map UnauthorizedAccess on open to PERMISSION_DENIED and route Posix lseek/pread/pwrite/rename/etc failures through PosixFailure so libc-style callers get RAX=-1 plus TLS errno, matching open/read/write.
This commit is contained in:
@@ -1558,7 +1558,7 @@ public static partial class KernelMemoryCompatExports
|
||||
{
|
||||
LogOpenTrace($"_open fail path='{guestPath}' host='{hostPath}' flags=0x{flags:X8} ex={ex.GetType().Name}: {ex.Message}");
|
||||
return ex is UnauthorizedAccessException
|
||||
? (int)OrbisGen2Result.ORBIS_GEN2_ERROR_INVALID_ARGUMENT
|
||||
? (int)OrbisGen2Result.ORBIS_GEN2_ERROR_PERMISSION_DENIED
|
||||
: (int)OrbisGen2Result.ORBIS_GEN2_ERROR_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
@@ -2228,8 +2228,7 @@ public static partial class KernelMemoryCompatExports
|
||||
|
||||
if (result != OrbisGen2Result.ORBIS_GEN2_OK)
|
||||
{
|
||||
ctx[CpuRegister.Rax] = ulong.MaxValue;
|
||||
return (int)OrbisGen2Result.ORBIS_GEN2_OK;
|
||||
return PosixFailure(ctx, (int)result, notFoundErrno: Ebadf);
|
||||
}
|
||||
|
||||
ctx[CpuRegister.Rax] = unchecked((ulong)position);
|
||||
|
||||
Reference in New Issue
Block a user