From 823a33b734de519a35660525f18f3d2e2f0ded0d Mon Sep 17 00:00:00 2001 From: reito Date: Mon, 9 Dec 2024 22:48:55 +0800 Subject: [PATCH] src: fix mingw --- src/win/pipe.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/win/pipe.c b/src/win/pipe.c index 943ddbeb..3a3eaf14 100644 --- a/src/win/pipe.c +++ b/src/win/pipe.c @@ -112,7 +112,7 @@ static int should_use_named_pipe(const char *s) { return strstr(s, pipe_prefix) == s; #else /* Disable this on mingw */ - return true; + return 1; #endif } @@ -570,9 +570,6 @@ static int uv__set_pipe_handle(uv_loop_t* loop, loop->iocp, (ULONG_PTR) handle, 0) == NULL) { - /* Unix domain socket should always support IOCP. */ - assert(!(handle->flags & UV_HANDLE_WIN_UDS_PIPE)); - handle->flags |= UV_HANDLE_EMULATE_IOCP; } } @@ -1057,6 +1054,17 @@ int uv_pipe_connect2(uv_connect_t* req, int use_win_named_pipe = should_use_named_pipe(name); +#if !defined(UV__DISABLE_WIN_UDS_PIPE) + if (!use_win_named_pipe) { + if (flags & UV_PIPE_NO_TRUNCATE) + if (namelen > UNIX_PATH_MAX) + return UV_EINVAL; + + if (namelen > UNIX_PATH_MAX) + namelen = UNIX_PATH_MAX; + } +#endif + name_copy = uv__malloc(namelen + 1); if (name_copy == NULL) { return UV_ENOMEM;