Skip to content

Commit 04a35ef

Browse files
authored
win,errors: remap ERROR_ACCESS_DENIED to UV_EACCES (libuv#3193)
If we try to use uv_fs_rmdir on a read-only directory on Windows, it internally calls _wrmdir, which sets _doserrno to ERROR_ACCESS_DENIED and errno to EACCES. However, ERROR_ACCESS_DENIED is mapped to UV_EPERM, so I believe it should be remapped to UV_EACCES.
1 parent cf7f70c commit 04a35ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/win/error.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ int uv_translate_sys_error(int sys_errno) {
7373
case WSAEACCES: return UV_EACCES;
7474
case ERROR_ELEVATION_REQUIRED: return UV_EACCES;
7575
case ERROR_CANT_ACCESS_FILE: return UV_EACCES;
76+
case ERROR_ACCESS_DENIED: return UV_EACCES;
7677
case ERROR_ADDRESS_ALREADY_ASSOCIATED: return UV_EADDRINUSE;
7778
case WSAEADDRINUSE: return UV_EADDRINUSE;
7879
case WSAEADDRNOTAVAIL: return UV_EADDRNOTAVAIL;
@@ -154,7 +155,6 @@ int uv_translate_sys_error(int sys_errno) {
154155
case WSAENOTSOCK: return UV_ENOTSOCK;
155156
case ERROR_NOT_SUPPORTED: return UV_ENOTSUP;
156157
case ERROR_BROKEN_PIPE: return UV_EOF;
157-
case ERROR_ACCESS_DENIED: return UV_EPERM;
158158
case ERROR_PRIVILEGE_NOT_HELD: return UV_EPERM;
159159
case ERROR_BAD_PIPE: return UV_EPIPE;
160160
case ERROR_NO_DATA: return UV_EPIPE;

0 commit comments

Comments
 (0)