[Pkg-wmaker-commits] [wmbiff] 25/92: wmbiff: Fix connection leak.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Thu Aug 20 02:59:21 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmbiff.
commit 02efc67727dc07d1ecd766ca6f6df0b1e68baeda
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Fri Nov 7 21:31:17 2014 -0600
wmbiff: Fix connection leak.
Patch by Arnaud Giersch <arnaud.giersch at iut-bm.univ-fcomte.fr>.
For more information, see:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=663876
---
wmbiff/socket.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/wmbiff/socket.c b/wmbiff/socket.c
index ff2c819..7f7a9ec 100644
--- a/wmbiff/socket.c
+++ b/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;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git
More information about the Pkg-wmaker-commits
mailing list