summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-12-23 11:28:42 +0100
committerThomas Haller <thaller@redhat.com>2018-12-24 01:00:59 +0100
commit13a80d2f1f2fe3c08e3b3110fcee36ed4f0491bc (patch)
treec0fc52a6219b6e634430f187ad26f49913714ac9
parentd636aee951d56c6bdbd85cfe4ddd1337cff389ef (diff)
downloadNetworkManager-th/nm-error.tar.gz
platform: use nm_steal_fd() in nmp_utils_sysctl_open_netdir()th/nm-error
-rw-r--r--src/platform/nm-platform-utils.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/platform/nm-platform-utils.c b/src/platform/nm-platform-utils.c
index 01651f466c..772d4667c3 100644
--- a/src/platform/nm-platform-utils.c
+++ b/src/platform/nm-platform-utils.c
@@ -1277,7 +1277,6 @@ nmp_utils_sysctl_open_netdir (int ifindex,
for (try_count = 0; try_count < 10; try_count++, ifname = NULL) {
nm_auto_close int fd_dir = -1;
nm_auto_close int fd_ifindex = -1;
- int fd;
if (!ifname) {
ifname = nmp_utils_if_indextoname (ifindex, ifname_buf);
@@ -1310,15 +1309,13 @@ nmp_utils_sysctl_open_netdir (int ifindex,
continue;
fd_buf[nn] = '\0';
- if (ifindex != _nm_utils_ascii_str_to_int64 (fd_buf, 10, 1, G_MAXINT, -1))
+ if (ifindex != (int) _nm_utils_ascii_str_to_int64 (fd_buf, 10, 1, G_MAXINT, -1))
continue;
if (out_ifname)
strcpy (out_ifname, ifname);
- fd = fd_dir;
- fd_dir = -1;
- return fd;
+ return nm_steal_fd (&fd_dir);
}
return -1;