Patch by Arnaud Giersch <arnaud.gier...@iut-bm.univ-fcomte.fr>.

For more information, see:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=663876
---
 wmbiff/wmbiff/socket.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/wmbiff/wmbiff/socket.c b/wmbiff/wmbiff/socket.c
index ff2c819..7f7a9ec 100644
--- a/wmbiff/wmbiff/socket.c
+++ b/wmbiff/wmbiff/socket.c
@@ -58,6 +58,8 @@ static int ipv4_sock_connect(struct in_addr *address, short 
port)
                printf("socket() failed.\n");
                return (-1);
        };
+       if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
+               perror("fcntl(FD_CLOEXEC)");
 
        addr.sin_family = AF_INET;
        addr.sin_addr.s_addr = *(u_long *) address;
@@ -122,6 +124,8 @@ int sock_connect(const char *hostname, int port)
                fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
                if (fd < 0)
                        continue;
+               if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
+                       perror("fcntl(FD_CLOEXEC)");
                if (connect(fd, res->ai_addr, res->ai_addrlen) < 0) {
                        close(fd);
                        fd = -1;
-- 
2.1.0


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to