提交 172b8113 编写于 作者: J Junio C Hamano

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
...@@ -73,6 +73,9 @@ typedef int pid_t; ...@@ -73,6 +73,9 @@ typedef int pid_t;
#ifndef ECONNABORTED #ifndef ECONNABORTED
#define ECONNABORTED WSAECONNABORTED #define ECONNABORTED WSAECONNABORTED
#endif #endif
#ifndef ENOTSOCK
#define ENOTSOCK WSAENOTSOCK
#endif
struct passwd { struct passwd {
char *pw_name; char *pw_name;
......
...@@ -673,9 +673,11 @@ static void set_keep_alive(int sockfd) ...@@ -673,9 +673,11 @@ static void set_keep_alive(int sockfd)
{ {
int ka = 1; int ka = 1;
if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &ka, sizeof(ka)) < 0) if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &ka, sizeof(ka)) < 0) {
logerror("unable to set SO_KEEPALIVE on socket: %s", if (errno != ENOTSOCK)
strerror(errno)); logerror("unable to set SO_KEEPALIVE on socket: %s",
strerror(errno));
}
} }
static int execute(void) static int execute(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册