summaryrefslogtreecommitdiff
path: root/daemon.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-08-08 14:21:37 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-08-08 14:21:37 -0700
commit172b811322e30ecb3cd660319890e41bc40006bc (patch)
tree69c96d5ea70cc4d53dbecee794cb8a09dfad449f /daemon.c
parentMerge branch 'nd/pack-ofs-4gb-limit' into maint (diff)
parentWindows: add missing definition of ENOTSOCK (diff)
downloadtgif-172b811322e30ecb3cd660319890e41bc40006bc.tar.xz
Merge branch 'ew/daemon-socket-keepalive' into maint
Recent update to "git daemon" tries to enable the socket-level KEEPALIVE, but when it is spawned via inetd, the standard input file descriptor may not necessarily be connected to a socket. Suppress an ENOTSOCK error from setsockopt(). * ew/daemon-socket-keepalive: Windows: add missing definition of ENOTSOCK daemon: ignore ENOTSOCK from setsockopt
Diffstat (limited to 'daemon.c')
-rw-r--r--daemon.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/daemon.c b/daemon.c
index 46dddaca5a..a84495113e 100644
--- a/daemon.c
+++ b/daemon.c
@@ -673,9 +673,11 @@ static void set_keep_alive(int sockfd)
{
int ka = 1;
- if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &ka, sizeof(ka)) < 0)
- logerror("unable to set SO_KEEPALIVE on socket: %s",
- strerror(errno));
+ if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &ka, sizeof(ka)) < 0) {
+ if (errno != ENOTSOCK)
+ logerror("unable to set SO_KEEPALIVE on socket: %s",
+ strerror(errno));
+ }
}
static int execute(void)