]> asedeno.scripts.mit.edu Git - git.git/blobdiff - daemon.c
send-email: add transfer encoding header with content-type
[git.git] / daemon.c
index 9cf22fef417cee29e550a35fef1bac1050482afa..b8df980dc57cc7b9f3710f4ee90b7aa3d18596ca 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -9,6 +9,10 @@
 #define HOST_NAME_MAX 256
 #endif
 
+#ifndef NI_MAXSERV
+#define NI_MAXSERV 32
+#endif
+
 static int log_syslog;
 static int verbose;
 static int reuseaddr;
@@ -536,7 +540,7 @@ static int execute(struct sockaddr *addr)
                if (addr->sa_family == AF_INET) {
                        struct sockaddr_in *sin_addr = (void *) addr;
                        inet_ntop(addr->sa_family, &sin_addr->sin_addr, addrbuf, sizeof(addrbuf));
-                       port = sin_addr->sin_port;
+                       port = ntohs(sin_addr->sin_port);
 #ifndef NO_IPV6
                } else if (addr && addr->sa_family == AF_INET6) {
                        struct sockaddr_in6 *sin6_addr = (void *) addr;
@@ -546,7 +550,7 @@ static int execute(struct sockaddr *addr)
                        inet_ntop(AF_INET6, &sin6_addr->sin6_addr, buf, sizeof(addrbuf) - 1);
                        strcat(buf, "]");
 
-                       port = sin6_addr->sin6_port;
+                       port = ntohs(sin6_addr->sin6_port);
 #endif
                }
                loginfo("Connection from %s:%d", addrbuf, port);