Revert "win,fs: correct error code in uv_fs_read and uv_fs_write"
This reverts commit 9394216828.
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:
parent
963ecc82d0
commit
103dbaede3
@ -758,7 +758,7 @@ void fs__read_filemap(uv_fs_t* req, struct uv__fd_info_s* fd_info) {
|
|||||||
void* view;
|
void* view;
|
||||||
|
|
||||||
if (rw_flags == UV_FS_O_WRONLY) {
|
if (rw_flags == UV_FS_O_WRONLY) {
|
||||||
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_FLAGS);
|
SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fd_info->is_directory) {
|
if (fd_info->is_directory) {
|
||||||
@ -936,7 +936,7 @@ void fs__write_filemap(uv_fs_t* req, HANDLE file,
|
|||||||
FILETIME ft;
|
FILETIME ft;
|
||||||
|
|
||||||
if (rw_flags == UV_FS_O_RDONLY) {
|
if (rw_flags == UV_FS_O_RDONLY) {
|
||||||
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_FLAGS);
|
SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fd_info->is_directory) {
|
if (fd_info->is_directory) {
|
||||||
|
|||||||
@ -276,21 +276,21 @@ static void fs_open_flags(int add_flags) {
|
|||||||
/* r */
|
/* r */
|
||||||
flags = add_flags | UV_FS_O_RDONLY;
|
flags = add_flags | UV_FS_O_RDONLY;
|
||||||
openFail(absent_file, UV_ENOENT);
|
openFail(absent_file, UV_ENOENT);
|
||||||
writeFail(empty_file, UV_EBADF);
|
writeFail(empty_file, UV_EPERM);
|
||||||
readExpect(empty_file, "", 0);
|
readExpect(empty_file, "", 0);
|
||||||
writeFail(dummy_file, UV_EBADF);
|
writeFail(dummy_file, UV_EPERM);
|
||||||
readExpect(dummy_file, "a", 1);
|
readExpect(dummy_file, "a", 1);
|
||||||
writeFail(empty_dir, UV_EBADF);
|
writeFail(empty_dir, UV_EPERM);
|
||||||
readFail(empty_dir, UV_EISDIR);
|
readFail(empty_dir, UV_EISDIR);
|
||||||
|
|
||||||
/* rs */
|
/* rs */
|
||||||
flags = add_flags | UV_FS_O_RDONLY | UV_FS_O_SYNC;
|
flags = add_flags | UV_FS_O_RDONLY | UV_FS_O_SYNC;
|
||||||
openFail(absent_file, UV_ENOENT);
|
openFail(absent_file, UV_ENOENT);
|
||||||
writeFail(empty_file, UV_EBADF);
|
writeFail(empty_file, UV_EPERM);
|
||||||
readExpect(empty_file, "", 0);
|
readExpect(empty_file, "", 0);
|
||||||
writeFail(dummy_file, UV_EBADF);
|
writeFail(dummy_file, UV_EPERM);
|
||||||
readExpect(dummy_file, "a", 1);
|
readExpect(dummy_file, "a", 1);
|
||||||
writeFail(empty_dir, UV_EBADF);
|
writeFail(empty_dir, UV_EPERM);
|
||||||
readFail(empty_dir, UV_EISDIR);
|
readFail(empty_dir, UV_EISDIR);
|
||||||
|
|
||||||
/* r+ */
|
/* r+ */
|
||||||
@ -316,18 +316,18 @@ static void fs_open_flags(int add_flags) {
|
|||||||
/* w */
|
/* w */
|
||||||
flags = add_flags | UV_FS_O_TRUNC | UV_FS_O_CREAT | UV_FS_O_WRONLY;
|
flags = add_flags | UV_FS_O_TRUNC | UV_FS_O_CREAT | UV_FS_O_WRONLY;
|
||||||
writeExpect(absent_file, "bc", 2);
|
writeExpect(absent_file, "bc", 2);
|
||||||
readFail(absent_file, UV_EBADF);
|
readFail(absent_file, UV_EPERM);
|
||||||
writeExpect(empty_file, "bc", 2);
|
writeExpect(empty_file, "bc", 2);
|
||||||
readFail(empty_file, UV_EBADF);
|
readFail(empty_file, UV_EPERM);
|
||||||
writeExpect(dummy_file, "bc", 2);
|
writeExpect(dummy_file, "bc", 2);
|
||||||
readFail(dummy_file, UV_EBADF);
|
readFail(dummy_file, UV_EPERM);
|
||||||
openFail(empty_dir, UV_EISDIR);
|
openFail(empty_dir, UV_EISDIR);
|
||||||
|
|
||||||
/* wx */
|
/* wx */
|
||||||
flags = add_flags | UV_FS_O_TRUNC | UV_FS_O_CREAT | UV_FS_O_WRONLY |
|
flags = add_flags | UV_FS_O_TRUNC | UV_FS_O_CREAT | UV_FS_O_WRONLY |
|
||||||
UV_FS_O_EXCL;
|
UV_FS_O_EXCL;
|
||||||
writeExpect(absent_file, "bc", 2);
|
writeExpect(absent_file, "bc", 2);
|
||||||
readFail(absent_file, UV_EBADF);
|
readFail(absent_file, UV_EPERM);
|
||||||
openFail(empty_file, UV_EEXIST);
|
openFail(empty_file, UV_EEXIST);
|
||||||
openFail(dummy_file, UV_EEXIST);
|
openFail(dummy_file, UV_EEXIST);
|
||||||
openFail(empty_dir, UV_EEXIST);
|
openFail(empty_dir, UV_EEXIST);
|
||||||
@ -354,19 +354,19 @@ static void fs_open_flags(int add_flags) {
|
|||||||
/* a */
|
/* a */
|
||||||
flags = add_flags | UV_FS_O_APPEND | UV_FS_O_CREAT | UV_FS_O_WRONLY;
|
flags = add_flags | UV_FS_O_APPEND | UV_FS_O_CREAT | UV_FS_O_WRONLY;
|
||||||
writeExpect(absent_file, "bc", 2);
|
writeExpect(absent_file, "bc", 2);
|
||||||
readFail(absent_file, UV_EBADF);
|
readFail(absent_file, UV_EPERM);
|
||||||
writeExpect(empty_file, "bc", 2);
|
writeExpect(empty_file, "bc", 2);
|
||||||
readFail(empty_file, UV_EBADF);
|
readFail(empty_file, UV_EPERM);
|
||||||
writeExpect(dummy_file, "abc", 3);
|
writeExpect(dummy_file, "abc", 3);
|
||||||
readFail(dummy_file, UV_EBADF);
|
readFail(dummy_file, UV_EPERM);
|
||||||
writeFail(empty_dir, UV_EISDIR);
|
writeFail(empty_dir, UV_EISDIR);
|
||||||
readFail(empty_dir, UV_EBADF);
|
readFail(empty_dir, UV_EPERM);
|
||||||
|
|
||||||
/* ax */
|
/* ax */
|
||||||
flags = add_flags | UV_FS_O_APPEND | UV_FS_O_CREAT | UV_FS_O_WRONLY |
|
flags = add_flags | UV_FS_O_APPEND | UV_FS_O_CREAT | UV_FS_O_WRONLY |
|
||||||
UV_FS_O_EXCL;
|
UV_FS_O_EXCL;
|
||||||
writeExpect(absent_file, "bc", 2);
|
writeExpect(absent_file, "bc", 2);
|
||||||
readFail(absent_file, UV_EBADF);
|
readFail(absent_file, UV_EPERM);
|
||||||
openFail(empty_file, UV_EEXIST);
|
openFail(empty_file, UV_EEXIST);
|
||||||
openFail(dummy_file, UV_EEXIST);
|
openFail(dummy_file, UV_EEXIST);
|
||||||
openFail(empty_dir, 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 |
|
flags = add_flags | UV_FS_O_APPEND | UV_FS_O_CREAT | UV_FS_O_WRONLY |
|
||||||
UV_FS_O_SYNC;
|
UV_FS_O_SYNC;
|
||||||
writeExpect(absent_file, "bc", 2);
|
writeExpect(absent_file, "bc", 2);
|
||||||
readFail(absent_file, UV_EBADF);
|
readFail(absent_file, UV_EPERM);
|
||||||
writeExpect(empty_file, "bc", 2);
|
writeExpect(empty_file, "bc", 2);
|
||||||
readFail(empty_file, UV_EBADF);
|
readFail(empty_file, UV_EPERM);
|
||||||
writeExpect(dummy_file, "abc", 3);
|
writeExpect(dummy_file, "abc", 3);
|
||||||
readFail(dummy_file, UV_EBADF);
|
readFail(dummy_file, UV_EPERM);
|
||||||
writeFail(empty_dir, UV_EISDIR);
|
writeFail(empty_dir, UV_EISDIR);
|
||||||
readFail(empty_dir, UV_EBADF);
|
readFail(empty_dir, UV_EPERM);
|
||||||
|
|
||||||
/* a+ */
|
/* a+ */
|
||||||
flags = add_flags | UV_FS_O_APPEND | UV_FS_O_CREAT | UV_FS_O_RDWR;
|
flags = add_flags | UV_FS_O_APPEND | UV_FS_O_CREAT | UV_FS_O_RDWR;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user