mirror of
https://github.com/libuv/libuv
synced 2025-03-28 21:13:16 +00:00
win: remap ERROR_NOACCESS and ERROR_BUFFER_OVERFLOW (#4567)
It seemed incorrect to map a segfault to EACCES, since posix would typically map this to EFAULT. The ERROR_BUFFER_OVERFLOW is literally "the filename is too long", and is not typically an invalid parameter in posix. Test originally added in #1060 to test the API, not the value.
This commit is contained in:
parent
9cf0710d71
commit
7e6590f31d
@ -69,7 +69,6 @@ int uv_translate_sys_error(int sys_errno) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (sys_errno) {
|
switch (sys_errno) {
|
||||||
case ERROR_NOACCESS: return UV_EACCES;
|
|
||||||
case WSAEACCES: return UV_EACCES;
|
case WSAEACCES: return UV_EACCES;
|
||||||
case ERROR_ELEVATION_REQUIRED: return UV_EACCES;
|
case ERROR_ELEVATION_REQUIRED: return UV_EACCES;
|
||||||
case ERROR_CANT_ACCESS_FILE: return UV_EACCES;
|
case ERROR_CANT_ACCESS_FILE: return UV_EACCES;
|
||||||
@ -96,7 +95,7 @@ int uv_translate_sys_error(int sys_errno) {
|
|||||||
case WSAECONNRESET: return UV_ECONNRESET;
|
case WSAECONNRESET: return UV_ECONNRESET;
|
||||||
case ERROR_ALREADY_EXISTS: return UV_EEXIST;
|
case ERROR_ALREADY_EXISTS: return UV_EEXIST;
|
||||||
case ERROR_FILE_EXISTS: return UV_EEXIST;
|
case ERROR_FILE_EXISTS: return UV_EEXIST;
|
||||||
case ERROR_BUFFER_OVERFLOW: return UV_EFAULT;
|
case ERROR_NOACCESS: return UV_EFAULT;
|
||||||
case WSAEFAULT: return UV_EFAULT;
|
case WSAEFAULT: return UV_EFAULT;
|
||||||
case ERROR_HOST_UNREACHABLE: return UV_EHOSTUNREACH;
|
case ERROR_HOST_UNREACHABLE: return UV_EHOSTUNREACH;
|
||||||
case WSAEHOSTUNREACH: return UV_EHOSTUNREACH;
|
case WSAEHOSTUNREACH: return UV_EHOSTUNREACH;
|
||||||
@ -127,6 +126,7 @@ int uv_translate_sys_error(int sys_errno) {
|
|||||||
case ERROR_TOO_MANY_OPEN_FILES: return UV_EMFILE;
|
case ERROR_TOO_MANY_OPEN_FILES: return UV_EMFILE;
|
||||||
case WSAEMFILE: return UV_EMFILE;
|
case WSAEMFILE: return UV_EMFILE;
|
||||||
case WSAEMSGSIZE: return UV_EMSGSIZE;
|
case WSAEMSGSIZE: return UV_EMSGSIZE;
|
||||||
|
case ERROR_BUFFER_OVERFLOW: return UV_ENAMETOOLONG;
|
||||||
case ERROR_FILENAME_EXCED_RANGE: return UV_ENAMETOOLONG;
|
case ERROR_FILENAME_EXCED_RANGE: return UV_ENAMETOOLONG;
|
||||||
case ERROR_NETWORK_UNREACHABLE: return UV_ENETUNREACH;
|
case ERROR_NETWORK_UNREACHABLE: return UV_ENETUNREACH;
|
||||||
case WSAENETUNREACH: return UV_ENETUNREACH;
|
case WSAENETUNREACH: return UV_ENETUNREACH;
|
||||||
|
@ -64,7 +64,7 @@ TEST_IMPL(error_message) {
|
|||||||
|
|
||||||
TEST_IMPL(sys_error) {
|
TEST_IMPL(sys_error) {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
ASSERT_EQ(uv_translate_sys_error(ERROR_NOACCESS), UV_EACCES);
|
ASSERT_EQ(uv_translate_sys_error(ERROR_NOACCESS), UV_EFAULT);
|
||||||
ASSERT_EQ(uv_translate_sys_error(ERROR_ELEVATION_REQUIRED), UV_EACCES);
|
ASSERT_EQ(uv_translate_sys_error(ERROR_ELEVATION_REQUIRED), UV_EACCES);
|
||||||
ASSERT_EQ(uv_translate_sys_error(WSAEADDRINUSE), UV_EADDRINUSE);
|
ASSERT_EQ(uv_translate_sys_error(WSAEADDRINUSE), UV_EADDRINUSE);
|
||||||
ASSERT_EQ(uv_translate_sys_error(ERROR_BAD_PIPE), UV_EPIPE);
|
ASSERT_EQ(uv_translate_sys_error(ERROR_BAD_PIPE), UV_EPIPE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user