File tree Expand file tree Collapse file tree 1 file changed +0
-41
lines changed
Expand file tree Collapse file tree 1 file changed +0
-41
lines changed Original file line number Diff line number Diff line change 1919 'src/js_native_api.h',
2020 'src/js_native_api_types.h',
2121 'src/node_api_types.h',
22- --- a/deps/uv/src/win/util.c
23- +++ b/deps/uv/src/win/util.c
24- @@ -1664,33 +1664,26 @@ int uv_os_unsetenv(const char* name) {
25-
26-
27- int uv_os_gethostname(char* buffer, size_t* size) {
28- - WCHAR buf[UV_MAXHOSTNAMESIZE];
29- + char buf[UV_MAXHOSTNAMESIZE];
30- size_t len;
31- - char* utf8_str;
32- - int convert_result;
33-
34- if (buffer == NULL || size == NULL || *size == 0)
35- return UV_EINVAL;
36-
37- uv__once_init(); /* Initialize winsock */
38-
39- - if (GetHostNameW(buf, UV_MAXHOSTNAMESIZE) != 0)
40- + if (gethostname(buf, sizeof(buf)) != 0)
41- return uv_translate_sys_error(WSAGetLastError());
42-
43- - convert_result = uv__convert_utf16_to_utf8(buf, -1, &utf8_str);
44- + buf[sizeof(buf) - 1] = '\0'; /* Null terminate, just to be safe. */
45- + len = strlen(buf);
46-
47- - if (convert_result != 0)
48- - return convert_result;
49- -
50- - len = strlen(utf8_str);
51- if (len >= *size) {
52- *size = len + 1;
53- - uv__free(utf8_str);
54- return UV_ENOBUFS;
55- }
56-
57- - memcpy(buffer, utf8_str, len + 1);
58- - uv__free(utf8_str);
59- + memcpy(buffer, buf, len + 1);
60- *size = len;
61- return 0;
62- }
You can’t perform that action at this time.
0 commit comments