summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fb15958)
raw | patch | inline | side by side (parent: fb15958)
author | Gerrit Pape <pape@smarden.org> | |
Mon, 5 Nov 2007 09:16:22 +0000 (09:16 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 6 Nov 2007 02:39:18 +0000 (18:39 -0800) |
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>
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>
daemon.c | patch | blob | history |
diff --git a/daemon.c b/daemon.c
index 660e1552d46b8566f162677af02d91dc351c5c3f..b8df980dc57cc7b9f3710f4ee90b7aa3d18596ca 100644 (file)
--- a/daemon.c
+++ b/daemon.c
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;
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);