summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-07-18 04:59:11 +0000
committerJunio C Hamano <gitster@pobox.com>2016-07-18 11:09:52 -0700
commit49c58d86ceb7816c5f0ca36e38e26cd6b8506d74 (patch)
tree4241ca444e05546e5343a78a0282e164c92601fe
parenta43b68a196652a0c6b054ee4905ac98d1cdcbbb9 (diff)
downloadgit-49c58d86ceb7816c5f0ca36e38e26cd6b8506d74.tar.gz
daemon: ignore ENOTSOCK from setsockopt
In inetd mode, we are not guaranteed stdin or stdout is a socket; callers could filter the data through a pipe or be testing with regular files. This prevents t5802 from polluting syslog. Signed-off-by: Eric Wong <e@80x24.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-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)