summaryrefslogtreecommitdiff
path: root/daemon.c
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2007-11-05 09:16:22 +0000
committerJunio C Hamano <gitster@pobox.com>2007-11-05 18:39:18 -0800
commitc67359be45be74e1056d6293c6bb09ee6d00a54a (patch)
tree9c425a0ab1ff9c78708bf5462c5954697f406163 /daemon.c
parentfb159580a1628947f0a088e24cfe6fe4c81d99d0 (diff)
downloadgit-c67359be45be74e1056d6293c6bb09ee6d00a54a.tar.gz
git-daemon: fix remote port number in log entry
The port number in struct sockaddr_in needs to be converted from network byte order to host byte order (on some architectures). Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'daemon.c')
-rw-r--r--daemon.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/daemon.c b/daemon.c
index 660e1552d4..b8df980dc5 100644
--- a/daemon.c
+++ b/daemon.c
@@ -540,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;
@@ -550,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);