summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-11-22 22:07:20 +0100
committerThomas Haller <thaller@redhat.com>2017-11-24 17:06:42 +0100
commit653aab70ac0a5dfa3e078a1cbbf6ab361eb242f3 (patch)
treeeb36d626242ec9528d99f231b34edd06cdfe7463
parent8060c2a9305a3ed3a4fd9397379e6e5242c24e74 (diff)
downloadNetworkManager-653aab70ac0a5dfa3e078a1cbbf6ab361eb242f3.tar.gz
platform: preserve errno in nm_platform_sysctl_get_int_checked()
It's not clear whether free() changes errno. Be sure about it. https://bugzilla.gnome.org/show_bug.cgi?id=790726
-rw-r--r--src/platform/nm-platform.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index f61355a084..0427a3687e 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -508,6 +508,7 @@ nm_platform_sysctl_get_int_checked (NMPlatform *self, const char *pathid, int di
{
char *value = NULL;
gint32 ret;
+ int errsv;
_CHECK_SELF (self, klass, fallback);
@@ -522,7 +523,9 @@ nm_platform_sysctl_get_int_checked (NMPlatform *self, const char *pathid, int di
}
ret = _nm_utils_ascii_str_to_int64 (value, base, min, max, fallback);
+ errsv = errno;
g_free (value);
+ errno = errsv;
return ret;
}