* [PATCH] daemon: ignore ENOTSOCK from setsockopt
@ 2016-07-18 4:59 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-07-18 4:59 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
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>
---
daemon.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/daemon.c b/daemon.c
index 46dddac..a844951 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)
--
EW
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-07-18 5:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-18 4:59 [PATCH] daemon: ignore ENOTSOCK from setsockopt Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).