1
0
mirror of https://github.com/libuv/libuv synced 2025-03-28 21:13:16 +00:00

Revert "win,fs: correct error code in uv_fs_read and uv_fs_write"

This reverts commit 93942168281680bca60ddbd8d4c596fabcb8efd9.

Refs: https://github.com/libuv/libuv/pull/3180
Refs: https://github.com/libuv/libuv/pull/3205
PR-URL: https://github.com/libuv/libuv/pull/3211
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
This commit is contained in:
Darshan Sen 2021-06-22 01:33:22 +05:30 committed by GitHub
parent 963ecc82d0
commit 103dbaede3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 21 deletions

View File

@ -758,7 +758,7 @@ void fs__read_filemap(uv_fs_t* req, struct uv__fd_info_s* fd_info) {
void* view;
if (rw_flags == UV_FS_O_WRONLY) {
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_FLAGS);
SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
return;
}
if (fd_info->is_directory) {
@ -936,7 +936,7 @@ void fs__write_filemap(uv_fs_t* req, HANDLE file,
FILETIME ft;
if (rw_flags == UV_FS_O_RDONLY) {
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_FLAGS);
SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
return;
}
if (fd_info->is_directory) {

View File

@ -276,21 +276,21 @@ static void fs_open_flags(int add_flags) {
/* r */
flags = add_flags | UV_FS_O_RDONLY;
openFail(absent_file, UV_ENOENT);
writeFail(empty_file, UV_EBADF);
writeFail(empty_file, UV_EPERM);
readExpect(empty_file, "", 0);
writeFail(dummy_file, UV_EBADF);
writeFail(dummy_file, UV_EPERM);
readExpect(dummy_file, "a", 1);
writeFail(empty_dir, UV_EBADF);
writeFail(empty_dir, UV_EPERM);
readFail(empty_dir, UV_EISDIR);
/* rs */
flags = add_flags | UV_FS_O_RDONLY | UV_FS_O_SYNC;
openFail(absent_file, UV_ENOENT);
writeFail(empty_file, UV_EBADF);
writeFail(empty_file, UV_EPERM);
readExpect(empty_file, "", 0);
writeFail(dummy_file, UV_EBADF);
writeFail(dummy_file, UV_EPERM);
readExpect(dummy_file, "a", 1);
writeFail(empty_dir, UV_EBADF);
writeFail(empty_dir, UV_EPERM);
readFail(empty_dir, UV_EISDIR);
/* r+ */
@ -316,18 +316,18 @@ static void fs_open_flags(int add_flags) {
/* w */
flags = add_flags | UV_FS_O_TRUNC | UV_FS_O_CREAT | UV_FS_O_WRONLY;
writeExpect(absent_file, "bc", 2);
readFail(absent_file, UV_EBADF);
readFail(absent_file, UV_EPERM);
writeExpect(empty_file, "bc", 2);
readFail(empty_file, UV_EBADF);
readFail(empty_file, UV_EPERM);
writeExpect(dummy_file, "bc", 2);
readFail(dummy_file, UV_EBADF);
readFail(dummy_file, UV_EPERM);
openFail(empty_dir, UV_EISDIR);
/* wx */
flags = add_flags | UV_FS_O_TRUNC | UV_FS_O_CREAT | UV_FS_O_WRONLY |
UV_FS_O_EXCL;
writeExpect(absent_file, "bc", 2);
readFail(absent_file, UV_EBADF);
readFail(absent_file, UV_EPERM);
openFail(empty_file, UV_EEXIST);
openFail(dummy_file, UV_EEXIST);
openFail(empty_dir, UV_EEXIST);
@ -354,19 +354,19 @@ static void fs_open_flags(int add_flags) {
/* a */
flags = add_flags | UV_FS_O_APPEND | UV_FS_O_CREAT | UV_FS_O_WRONLY;
writeExpect(absent_file, "bc", 2);
readFail(absent_file, UV_EBADF);
readFail(absent_file, UV_EPERM);
writeExpect(empty_file, "bc", 2);
readFail(empty_file, UV_EBADF);
readFail(empty_file, UV_EPERM);
writeExpect(dummy_file, "abc", 3);
readFail(dummy_file, UV_EBADF);
readFail(dummy_file, UV_EPERM);
writeFail(empty_dir, UV_EISDIR);
readFail(empty_dir, UV_EBADF);
readFail(empty_dir, UV_EPERM);
/* ax */
flags = add_flags | UV_FS_O_APPEND | UV_FS_O_CREAT | UV_FS_O_WRONLY |
UV_FS_O_EXCL;
writeExpect(absent_file, "bc", 2);
readFail(absent_file, UV_EBADF);
readFail(absent_file, UV_EPERM);
openFail(empty_file, UV_EEXIST);
openFail(dummy_file, UV_EEXIST);
openFail(empty_dir, UV_EEXIST);
@ -375,13 +375,13 @@ static void fs_open_flags(int add_flags) {
flags = add_flags | UV_FS_O_APPEND | UV_FS_O_CREAT | UV_FS_O_WRONLY |
UV_FS_O_SYNC;
writeExpect(absent_file, "bc", 2);
readFail(absent_file, UV_EBADF);
readFail(absent_file, UV_EPERM);
writeExpect(empty_file, "bc", 2);
readFail(empty_file, UV_EBADF);
readFail(empty_file, UV_EPERM);
writeExpect(dummy_file, "abc", 3);
readFail(dummy_file, UV_EBADF);
readFail(dummy_file, UV_EPERM);
writeFail(empty_dir, UV_EISDIR);
readFail(empty_dir, UV_EBADF);
readFail(empty_dir, UV_EPERM);
/* a+ */
flags = add_flags | UV_FS_O_APPEND | UV_FS_O_CREAT | UV_FS_O_RDWR;