Commit 9fe70c9e by Andreas Smas

Use SOCK_CLOEXEC when creating sockets

parent c7c5f2c4
...@@ -60,6 +60,9 @@ ...@@ -60,6 +60,9 @@
#ifndef O_CLOEXEC #ifndef O_CLOEXEC
#define O_CLOEXEC 0 #define O_CLOEXEC 0
#endif #endif
#ifndef SOCK_CLOEXEC
#define SOCK_CLOEXEC 0
#endif
/* access() mode parameter #defines */ /* access() mode parameter #defines */
#ifndef F_OK #ifndef F_OK
......
...@@ -104,7 +104,7 @@ int socket_connect(git_stream *stream) ...@@ -104,7 +104,7 @@ int socket_connect(git_stream *stream)
} }
for (p = info; p != NULL; p = p->ai_next) { 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) if (s == INVALID_SOCKET)
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment