@@ -117,15 +117,14 @@ void uv_process_getaddrinfo_req(uv_loop_t* loop, uv_getaddrinfo_t* handle,
117
117
struct addrinfo * addrinfo_ptr ;
118
118
char * alloc_ptr = NULL ;
119
119
char * cur_ptr = NULL ;
120
- uv_err_code uv_ret ;
120
+ int status = 0 ;
121
121
122
122
/* release input parameter memory */
123
123
if (handle -> alloc != NULL ) {
124
124
free (handle -> alloc );
125
125
handle -> alloc = NULL ;
126
126
}
127
127
128
- uv_ret = uv_translate_eai_error (handle -> retcode );
129
128
if (handle -> retcode == 0 ) {
130
129
/* convert addrinfoW to addrinfo */
131
130
/* first calculate required length */
@@ -136,7 +135,8 @@ void uv_process_getaddrinfo_req(uv_loop_t* loop, uv_getaddrinfo_t* handle,
136
135
if (addrinfow_ptr -> ai_canonname != NULL ) {
137
136
name_len = uv_utf16_to_utf8 (addrinfow_ptr -> ai_canonname , -1 , NULL , 0 );
138
137
if (name_len == 0 ) {
139
- uv_ret = uv_translate_sys_error (GetLastError ());
138
+ uv__set_sys_error (loop , GetLastError ());
139
+ status = -1 ;
140
140
goto complete ;
141
141
}
142
142
addrinfo_len += ALIGNED_SIZE (name_len );
@@ -201,9 +201,13 @@ void uv_process_getaddrinfo_req(uv_loop_t* loop, uv_getaddrinfo_t* handle,
201
201
}
202
202
}
203
203
} else {
204
- uv_ret = UV_ENOMEM ;
204
+ uv__set_artificial_error (loop , UV_ENOMEM );
205
+ status = -1 ;
205
206
}
206
-
207
+ } else {
208
+ /* GetAddrInfo failed */
209
+ uv__set_artificial_error (loop , uv_translate_eai_error (handle -> retcode ));
210
+ status = -1 ;
207
211
}
208
212
209
213
/* return memory to system */
@@ -214,7 +218,7 @@ void uv_process_getaddrinfo_req(uv_loop_t* loop, uv_getaddrinfo_t* handle,
214
218
215
219
complete :
216
220
/* finally do callback with converted result */
217
- handle -> getaddrinfo_cb (handle , uv_ret , (struct addrinfo * )alloc_ptr );
221
+ handle -> getaddrinfo_cb (handle , status , (struct addrinfo * )alloc_ptr );
218
222
219
223
uv_unref (loop );
220
224
}
0 commit comments