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
This commit is contained in:
Thomas Haller 2017-11-22 22:07:20 +01:00
parent 8060c2a930
commit 653aab70ac

View file

@ -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;
}