Use EVUTIL_SOCKET_ERROR() wrapper to save/restor errno in evhttp_connection_fail_

This commit is contained in:
Nick Mathewson 2012-11-16 11:51:42 -05:00
parent 29fea33a7c
commit 7afbd60266

4
http.c
View File

@ -681,7 +681,7 @@ void
evhttp_connection_fail_(struct evhttp_connection *evcon,
enum evhttp_connection_error error)
{
const int errsave = errno;
const int errsave = EVUTIL_SOCKET_ERROR();
struct evhttp_request* req = TAILQ_FIRST(&evcon->requests);
void (*cb)(struct evhttp_request *, void *);
void *cb_arg;
@ -731,7 +731,7 @@ evhttp_connection_fail_(struct evhttp_connection *evcon,
* Let's restore the original errno, so that the user's
* callback can have a better idea of what the error was.
*/
errno = errsave;
EVUTIL_SET_SOCKET_ERROR(errsave);
/* inform the user */
if (cb != NULL)