diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-10-23 14:16:24 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2011-10-25 13:34:30 +0200 |
commit | bd972fef32de3560bbe23ef41ba2281b696764fd (patch) | |
tree | ce3e623b69f4152ec61847e82390ce29179bccfe /plugins/vpn.c | |
parent | 4826f90b555f009972276be1fa945d81b435950a (diff) | |
download | connman-bd972fef32de3560bbe23ef41ba2281b696764fd.tar.gz connman-bd972fef32de3560bbe23ef41ba2281b696764fd.tar.bz2 connman-bd972fef32de3560bbe23ef41ba2281b696764fd.zip |
plugins: Add O_CLOEXEC to open()
Make sure all file descriptor are closed.
Diffstat (limited to 'plugins/vpn.c')
-rw-r--r-- | plugins/vpn.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/vpn.c b/plugins/vpn.c index efeb9592..b9b97c1b 100644 --- a/plugins/vpn.c +++ b/plugins/vpn.c @@ -74,7 +74,7 @@ static int kill_tun(char *tun_name) ifr.ifr_flags = IFF_TUN | IFF_NO_PI; sprintf(ifr.ifr_name, "%s", tun_name); - fd = open("/dev/net/tun", O_RDWR); + fd = open("/dev/net/tun", O_RDWR | O_CLOEXEC); if (fd < 0) { err = -errno; connman_error("Failed to open /dev/net/tun to device %s: %s", @@ -228,7 +228,7 @@ static int vpn_connect(struct connman_provider *provider) name = connman_provider_get_driver_name(provider); vpn_driver_data = g_hash_table_lookup(driver_hash, name); - fd = open("/dev/net/tun", O_RDWR); + fd = open("/dev/net/tun", O_RDWR | O_CLOEXEC); if (fd < 0) { i = -errno; connman_error("Failed to open /dev/net/tun: %s", |