summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2017-12-22 15:23:11 +0000
committerZefram <zefram@fysh.org>2017-12-22 16:37:47 +0000
commita50ffd24fc4971e22bead1ab6f1eada47e042362 (patch)
tree3573a518663bfc54df935bbbf6b826dd966edaa8 /util.c
parent2cdf406af42834c46ef407517daab0734f7066fc (diff)
downloadperl-a50ffd24fc4971e22bead1ab6f1eada47e042362.tar.gz
mask off SOCK_CLOEXEC in socketpair() emulation
In the unlikely situation that we have SOCK_CLOEXEC but are emulating socketpair(), having the bit set could confuse the emulation. It's not worth actually implementing SOCK_CLOEXEC logic for this situation, so just mask it off. The higher-level logic of PerlSock_socketpair_cloexec() will handle the bit being ineffective.
Diffstat (limited to 'util.c')
-rw-r--r--util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/util.c b/util.c
index 41aadca8c2..0fc7af6866 100644
--- a/util.c
+++ b/util.c
@@ -4176,6 +4176,10 @@ Perl_my_socketpair (int family, int type, int protocol, int fd[2]) {
return -1;
}
+#ifdef SOCK_CLOEXEC
+ type &= ~SOCK_CLOEXEC;
+#endif
+
#ifdef EMULATE_SOCKETPAIR_UDP
if (type == SOCK_DGRAM)
return S_socketpair_udp(fd);