summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2011-10-23 12:16:30 (GMT)
committerMarcel Holtmann <marcel@holtmann.org>2011-10-25 11:36:42 (GMT)
commitbb1b20cbef2fbb82ee272af3b475dc4cff9c08aa (patch)
treeabf97b79102b498edcd3ce06f4a199c6f96088f9 /tools
parent3866231ce4dd27533e086490b84b5363d788721d (diff)
downloadconnman-bb1b20cbef2fbb82ee272af3b475dc4cff9c08aa.zip
connman-bb1b20cbef2fbb82ee272af3b475dc4cff9c08aa.tar.gz
connman-bb1b20cbef2fbb82ee272af3b475dc4cff9c08aa.tar.bz2
tools: Add SOCK_CLOEXEC to socket()
Make sure all file descriptor are closed.
Diffstat (limited to 'tools')
-rw-r--r--tools/alg-test.c2
-rw-r--r--tools/iptables-test.c2
-rw-r--r--tools/tap-test.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/tools/alg-test.c b/tools/alg-test.c
index 7ab740e..48f0a56 100644
--- a/tools/alg-test.c
+++ b/tools/alg-test.c
@@ -85,7 +85,7 @@ static int create_socket(void)
};
int sk, nsk;
- sk = socket(PF_ALG, SOCK_SEQPACKET, 0);
+ sk = socket(PF_ALG, SOCK_SEQPACKET | SOCK_CLOEXEC, 0);
if (sk < 0) {
perror("Failed to create socket");
return -1;
diff --git a/tools/iptables-test.c b/tools/iptables-test.c
index 35c6300..133c4f9 100644
--- a/tools/iptables-test.c
+++ b/tools/iptables-test.c
@@ -1159,7 +1159,7 @@ static struct connman_iptables *connman_iptables_init(const char *table_name)
if (table->info == NULL)
goto err;
- table->ipt_sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
+ table->ipt_sock = socket(AF_INET, SOCK_RAW | SOCK_CLOEXEC, IPPROTO_RAW);
if (table->ipt_sock < 0)
goto err;
diff --git a/tools/tap-test.c b/tools/tap-test.c
index 18fc00b..314d6bc 100644
--- a/tools/tap-test.c
+++ b/tools/tap-test.c
@@ -43,7 +43,7 @@ static int inet_ifup(const char *ifname)
struct ifreq ifr;
int sk, err;
- sk = socket(PF_INET, SOCK_DGRAM, 0);
+ sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (sk < 0)
return -errno;