diff options
-rw-r--r-- | src/posix.h | 3 | ||||
-rw-r--r-- | src/socket_stream.c | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/posix.h b/src/posix.h index 3e3bcb287..2934f2479 100644 --- a/src/posix.h +++ b/src/posix.h @@ -60,6 +60,9 @@ #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif +#ifndef SOCK_CLOEXEC +#define SOCK_CLOEXEC 0 +#endif /* access() mode parameter #defines */ #ifndef F_OK diff --git a/src/socket_stream.c b/src/socket_stream.c index 4c795e462..3c2a07c02 100644 --- a/src/socket_stream.c +++ b/src/socket_stream.c @@ -104,7 +104,7 @@ int socket_connect(git_stream *stream) } for (p = info; p != NULL; p = p->ai_next) { - s = socket(p->ai_family, p->ai_socktype, p->ai_protocol); + s = socket(p->ai_family, p->ai_socktype | SOCK_CLOEXEC, p->ai_protocol); if (s == INVALID_SOCKET) continue; |