From df78de04e46a8dbe341f418052238da0141a69af Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Sun, 13 Feb 2022 07:40:10 +0100 Subject: [PATCH] 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. --- src/win/fs.c | 3 +-- test/test-pipe-set-non-blocking.c | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/win/fs.c b/src/win/fs.c index 90376414..41aeffdd 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -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); diff --git a/test/test-pipe-set-non-blocking.c b/test/test-pipe-set-non-blocking.c index 8246afaf..827e7264 100644 --- a/test/test-pipe-set-non-blocking.c +++ b/test/test-pipe-set-non-blocking.c @@ -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 }