]> granicus.if.org Git - libevent/commitdiff
Use EVUTIL_SOCKET_ERROR() wrapper to save/restor errno in evhttp_connection_fail_
authorNick Mathewson <nickm@torproject.org>
Fri, 16 Nov 2012 16:51:42 +0000 (11:51 -0500)
committerNick Mathewson <nickm@torproject.org>
Fri, 16 Nov 2012 16:51:42 +0000 (11:51 -0500)
http.c

diff --git a/http.c b/http.c
index 03305e56fa33eba9c2f9b2e96c51e0ed8d9ac712..22a46a951b9c1a4428d72434fe5673a6e46cdf76 100644 (file)
--- a/http.c
+++ b/http.c
@@ -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)