From bb9378251a167ef0116f263912e57f715c1e02ac Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 3 Aug 2013 15:00:11 +0200 Subject: network: Use SOCK_CLOEXEC when available --- libavformat/network.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libavformat/network.h') diff --git a/libavformat/network.h b/libavformat/network.h index fe136c4e47..99d96afda9 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -246,4 +246,13 @@ int ff_listen_connect(int fd, const struct sockaddr *addr, int ff_http_match_no_proxy(const char *no_proxy, const char *hostname); +#ifndef SOCK_CLOEXEC +#define SOCK_CLOEXEC 0 +#endif + +static inline int ff_socket(int domain, int type, int protocol) +{ + return socket(domain, type | SOCK_CLOEXEC, protocol); +} + #endif /* AVFORMAT_NETWORK_H */ -- cgit v1.2.3