all: use O_CLOEXEC for file descriptors

This commit is contained in:
Thomas Haller
2016-12-10 15:28:15 +01:00
parent e332c27824
commit 4bdee37771
18 changed files with 35 additions and 34 deletions

View File

@@ -70,7 +70,7 @@ ethtool_get (const char *name, gpointer edata)
nm_utils_ifname_cpy (ifr.ifr_name, name);
ifr.ifr_data = edata;
fd = socket (PF_INET, SOCK_DGRAM, 0);
fd = socket (PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (fd < 0) {
nm_log_err (LOGD_PLATFORM, "ethtool: Could not open socket.");
return FALSE;
@@ -410,7 +410,7 @@ nmp_utils_mii_supports_carrier_detect (const char *ifname)
if (!nmp_utils_device_exists (ifname))
return FALSE;
fd = socket (PF_INET, SOCK_DGRAM, 0);
fd = socket (PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (fd < 0) {
nm_log_err (LOGD_PLATFORM, "mii: couldn't open control socket (%s)", ifname);
return FALSE;