From c67359be45be74e1056d6293c6bb09ee6d00a54a Mon Sep 17 00:00:00 2001 From: Gerrit Pape Date: Mon, 5 Nov 2007 09:16:22 +0000 Subject: 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 Signed-off-by: Junio C Hamano --- daemon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'daemon.c') 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); -- cgit v1.2.3 From f3fa1838024dc0f3741d2f9654af92f6a1bb34bd Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 8 Nov 2007 15:35:32 -0800 Subject: Style: place opening brace of a function definition at column 1 Signed-off-by: Junio C Hamano --- daemon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'daemon.c') diff --git a/daemon.c b/daemon.c index b8df980dc5..41a60af624 100644 --- a/daemon.c +++ b/daemon.c @@ -406,7 +406,8 @@ static struct daemon_service daemon_service[] = { { "receive-pack", "receivepack", receive_pack, 0, 1 }, }; -static void enable_service(const char *name, int ena) { +static void enable_service(const char *name, int ena) +{ int i; for (i = 0; i < ARRAY_SIZE(daemon_service); i++) { if (!strcmp(daemon_service[i].name, name)) { @@ -417,7 +418,8 @@ static void enable_service(const char *name, int ena) { die("No such service %s", name); } -static void make_service_overridable(const char *name, int ena) { +static void make_service_overridable(const char *name, int ena) +{ int i; for (i = 0; i < ARRAY_SIZE(daemon_service); i++) { if (!strcmp(daemon_service[i].name, name)) { -- cgit v1.2.3