]> granicus.if.org Git - libevent/commitdiff
Remove gratuitous tor-isms in evutil_socketpair(); fix a windows warning in http.c.
authorNick Mathewson <nickm@torproject.org>
Thu, 20 Sep 2007 18:38:31 +0000 (18:38 +0000)
committerNick Mathewson <nickm@torproject.org>
Thu, 20 Sep 2007 18:38:31 +0000 (18:38 +0000)
svn:r446

evutil.c
http.c

index 2af3115b2b27a3f25b1bee67645e680302b21d9b..44b3a10a4b61998bb9cb49dc7cebb080f2c2a451 100644 (file)
--- a/evutil.c
+++ b/evutil.c
@@ -32,6 +32,7 @@
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #undef WIN32_LEAN_AND_MEAN
+#include <winsock2.h>
 #include "misc.h"
 #endif
 
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
+#include <errno.h>
 
 #include "evutil.h"
 #include "log.h"
 
 int
-evutil_socketpair(int d, int type, int protocol, int sv[2])
+evutil_socketpair(int family, int type, int protocol, int fd[2])
 {
 #ifndef WIN32
-       return socketpair(d, type, protocol, sv);
+       return socketpair(family, type, protocol, fd);
 #else
        /* This code is originally from Tor.  Used with permission. */
 
@@ -81,9 +83,9 @@ evutil_socketpair(int d, int type, int protocol, int sv[2])
                return -EINVAL;
        }
 
-       listener = tor_open_socket(AF_INET, type, 0);
+       listener = socket(AF_INET, type, 0);
        if (listener < 0)
-               return -tor_socket_errno(-1);
+               return -errno;
        memset(&listen_addr, 0, sizeof(listen_addr));
        listen_addr.sin_family = AF_INET;
        listen_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
@@ -94,7 +96,7 @@ evutil_socketpair(int d, int type, int protocol, int sv[2])
        if (listen(listener, 1) == -1)
                goto tidy_up_and_fail;
 
-       connector = tor_open_socket(AF_INET, type, 0);
+       connector = socket(AF_INET, type, 0);
        if (connector < 0)
                goto tidy_up_and_fail;
        /* We want to find out the port number to connect to.  */
diff --git a/http.c b/http.c
index e0f8ff5f7acfa487410c41d5c0a24a4b821f796d..0d9524233673f26722f1c6eb40cbb9cb399529c8 100644 (file)
--- a/http.c
+++ b/http.c
@@ -336,7 +336,10 @@ evhttp_make_header_response(struct evhttp_connection *evcon,
                if (evhttp_find_header(req->output_headers,
                                                           "Date") == NULL) {
                        char date[50];
-                       struct tm cur, *cur_p;
+#ifndef WIN32
+                       struct tm cur;
+#endif
+                       struct tm *cur_p;
                        time_t t = time(NULL);
 #ifdef WIN32
                        cur_p = gmtime(&t);