chiark / gitweb /
Check return value from reading name_assign_type attr
authorDave Reisner <dreisner@archlinux.org>
Sat, 6 Dec 2014 18:34:27 +0000 (13:34 -0500)
committerTom Gundersen <teg@jklm.no>
Mon, 8 Dec 2014 17:38:55 +0000 (18:38 +0100)
This file won't exist on kernels earlier than 3.17.

src/network/networkd-network.c

index bbc6475..75cc7d2 100644 (file)
@@ -231,7 +231,8 @@ int network_get(Manager *manager, struct udev_device *device,
 
                         if (network->match_name) {
                                 attr = udev_device_get_sysattr_value(device, "name_assign_type");
-                                (void)safe_atou8(attr, &name_assign_type);
+                                if (attr)
+                                        (void)safe_atou8(attr, &name_assign_type);
 
                                 if (name_assign_type == NET_NAME_ENUM)
                                         log_warning("%-*s: found matching network '%s', based on potentially unstable ifname",