From: Daniel Wagner Date: Sun, 23 Oct 2011 12:16:24 +0000 (+0200) Subject: plugins: Add O_CLOEXEC to open() X-Git-Tag: 2.0_alpha~1019 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd972fef32de3560bbe23ef41ba2281b696764fd;p=framework%2Fconnectivity%2Fconnman.git plugins: Add O_CLOEXEC to open() Make sure all file descriptor are closed. --- diff --git a/plugins/tist.c b/plugins/tist.c index b8c89cf..9b0d3f7 100644 --- a/plugins/tist.c +++ b/plugins/tist.c @@ -370,7 +370,7 @@ static int install_ldisc(GIOChannel *channel, gboolean install) DBG("opening %s custom baud %lu", uart_dev_name, baud_rate); - uart_fd = open(uart_dev_name, O_RDWR); + uart_fd = open(uart_dev_name, O_RDWR | O_CLOEXEC); if (uart_fd < 0) return -EIO; @@ -522,7 +522,7 @@ static int tist_init(void) return err; } - fd = open(TIST_SYSFS_INSTALL, O_RDONLY); + fd = open(TIST_SYSFS_INSTALL, O_RDONLY | O_CLOEXEC); if (fd < 0) { connman_error("Failed to open TI ST sysfs install file"); return -EIO; diff --git a/plugins/vpn.c b/plugins/vpn.c index efeb959..b9b97c1 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",