mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-25 09:30:43 +01:00
platform: fix a crash when nm_platform_sysctl_get() returns NULL (rh #1010522)
nm_platform_sysctl_get() can return NULL on an error (when file specified by 'path' argument doesn't exist, can't be opened, etc.) https://bugzilla.redhat.com/show_bug.cgi?id=1010522
This commit is contained in:
parent
28530239fa
commit
2b72214e52
1 changed files with 4 additions and 0 deletions
|
|
@ -1946,12 +1946,16 @@ tun_get_properties (NMPlatform *platform, int ifindex, NMPlatformTunProperties *
|
|||
path = g_strdup_printf ("/sys/class/net/%s/group", ifname);
|
||||
val = nm_platform_sysctl_get (path);
|
||||
g_free (path);
|
||||
if (!val)
|
||||
return FALSE;
|
||||
props->group = strtoll (val, NULL, 10);
|
||||
g_free (val);
|
||||
|
||||
path = g_strdup_printf ("/sys/class/net/%s/tun_flags", ifname);
|
||||
val = nm_platform_sysctl_get (path);
|
||||
g_free (path);
|
||||
if (!val)
|
||||
return FALSE;
|
||||
flags = strtoul (val, NULL, 16);
|
||||
props->mode = ((flags & TUN_TYPE_MASK) == TUN_TUN_DEV) ? "tun" : "tap";
|
||||
props->no_pi = !!(flags & IFF_NO_PI);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue