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

win,fs: consider broken pipe error a normal EOF (#3053)

This would later get translated in src/win/error.c this way, which
previously could lead to rather confusing and inaccurate error messages.
This commit is contained in:
Momtchil Momtchev 2022-02-13 07:40:10 +01:00 committed by GitHub
parent 912bb8c577
commit df78de04e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 6 deletions

View File

@ -912,12 +912,11 @@ void fs__read(uv_fs_t* req) {
SET_REQ_RESULT(req, bytes);
} else {
error = GetLastError();
if (error == ERROR_ACCESS_DENIED) {
error = ERROR_INVALID_FLAGS;
}
if (error == ERROR_HANDLE_EOF) {
if (error == ERROR_HANDLE_EOF || error == ERROR_BROKEN_PIPE) {
SET_REQ_RESULT(req, bytes);
} else {
SET_REQ_WIN32_ERROR(req, error);

View File

@ -46,11 +46,7 @@ static void thread_main(void* arg) {
uv_fs_req_cleanup(&req);
} while (n > 0 || (n == -1 && uv_errno == UV_EINTR));
#ifdef _WIN32
ASSERT(n == UV_EOF);
#else
ASSERT(n == 0);
#endif
}