From 06550ec289b21a4f20cd79dca2d1e37723c23e4c Mon Sep 17 00:00:00 2001 From: Gregor Richards Date: Thu, 22 Sep 2016 21:02:26 -0400 Subject: [PATCH] Check if setting CLOEXEC fails on the Netplay server port. --- network/netplay/netplay.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/network/netplay/netplay.c b/network/netplay/netplay.c index 54826c8430..b35e78c9c5 100644 --- a/network/netplay/netplay.c +++ b/network/netplay/netplay.c @@ -846,7 +846,8 @@ static int init_tcp_connection(const struct addrinfo *res, #if defined(F_SETFD) && defined(FD_CLOEXEC) /* Don't let any inherited processes keep open our port */ - fcntl(fd, F_SETFD, FD_CLOEXEC); + if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) + RARCH_WARN("Cannot set Netplay port to close-on-exec. It may fail to reopen if the client disconnects.\n"); #endif }