From 5f6a21365f690bae8fa460ff611afd668299a358 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Fri, 16 Sep 2022 07:33:01 +0200 Subject: [PATCH] fix: uv_os_gethostname failing on Windows 7 (libuv patch regression) (#35702) Co-authored-by: Milan Burda --- ...ash_caused_by_gethostnamew_on_windows_7.patch | 16 +++++++++++++++- ...lang_-wdeprecated-declarations_in_libuv.patch | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/patches/node/fix_crash_caused_by_gethostnamew_on_windows_7.patch b/patches/node/fix_crash_caused_by_gethostnamew_on_windows_7.patch index 5ebadbf25bec8..8d1899062c761 100644 --- a/patches/node/fix_crash_caused_by_gethostnamew_on_windows_7.patch +++ b/patches/node/fix_crash_caused_by_gethostnamew_on_windows_7.patch @@ -6,7 +6,7 @@ Subject: fix: crash caused by GetHostNameW on Windows 7 Backported from https://github.com/libuv/libuv/pull/3285. diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c -index 33e874ac442f88b58d2b68c8ec9764f6f664552e..2d4cc0aaa02e61bf359e80eca27527efb49fd85e 100644 +index 33e874ac442f88b58d2b68c8ec9764f6f664552e..37ece5e2867ab836492a8b7faa0aa5e1b8e562f0 100644 --- a/deps/uv/src/win/util.c +++ b/deps/uv/src/win/util.c @@ -37,6 +37,7 @@ @@ -166,3 +166,17 @@ index 33e874ac442f88b58d2b68c8ec9764f6f664552e..2d4cc0aaa02e61bf359e80eca27527ef int uv_os_gethostname(char* buffer, size_t* size) { WCHAR buf[UV_MAXHOSTNAMESIZE]; size_t len; +@@ -1674,10 +1803,10 @@ int uv_os_gethostname(char* buffer, size_t* size) { + + uv__once_init(); /* Initialize winsock */ + +- if (pGetHostNameW == NULL) +- return UV_ENOSYS; ++ uv_sGetHostNameW gethostnamew = ++ pGetHostNameW == NULL ? uv__gethostnamew_nt60 : pGetHostNameW; + +- if (pGetHostNameW(buf, UV_MAXHOSTNAMESIZE) != 0) ++ if (gethostnamew(buf, UV_MAXHOSTNAMESIZE) != 0) + return uv_translate_sys_error(WSAGetLastError()); + + convert_result = uv__convert_utf16_to_utf8(buf, -1, &utf8_str); diff --git a/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch b/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch index bb7df671a3957..a6ae0650793b4 100644 --- a/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch +++ b/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch @@ -6,7 +6,7 @@ Subject: fix: suppress clang -Wdeprecated-declarations in libuv Should be upstreamed. diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c -index 2d4cc0aaa02e61bf359e80eca27527efb49fd85e..aaa16052e2a9c7d1dca82763c41c0890371f1471 100644 +index 37ece5e2867ab836492a8b7faa0aa5e1b8e562f0..d50296728f7e0810064647125a469f3ed714f8ea 100644 --- a/deps/uv/src/win/util.c +++ b/deps/uv/src/win/util.c @@ -1950,10 +1950,17 @@ int uv_os_uname(uv_utsname_t* buffer) {