]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev/net_id: parse _SUN ACPI index as a signed integer
authorMichal Sekletár <msekleta@redhat.com>
Mon, 19 Oct 2020 08:56:11 +0000 (10:56 +0200)
committerMichal Sekletár <msekleta@redhat.com>
Mon, 19 Oct 2020 10:18:03 +0000 (12:18 +0200)
Negative value means there is no match between a PCI device and any of
the slots. In the following commit we will extend this and value of 0
will indicate that there is a match between some slot and PCI device,
but that device is a PCI bridge.

src/udev/udev-builtin-net_id.c

index f070c1dc9cecfa206a81435e1eabf229352067d6..b88133e37d1a8de2d069d8b2b8c16094b0d23e11 100644 (file)
@@ -245,7 +245,8 @@ static bool is_pci_ari_enabled(sd_device *dev) {
 
 static int dev_pci_slot(sd_device *dev, struct netnames *names) {
         unsigned long dev_port = 0;
-        unsigned domain, bus, slot, func, hotplug_slot = 0;
+        unsigned domain, bus, slot, func;
+        int hotplug_slot = -1;
         size_t l;
         char *s;
         const char *sysname, *attr, *port_name = NULL, *syspath;
@@ -326,14 +327,14 @@ static int dev_pci_slot(sd_device *dev, struct netnames *names) {
                         continue;
 
                 FOREACH_DIRENT_ALL(dent, dir, break) {
-                        unsigned i;
+                        int i;
                         char str[PATH_MAX];
                         _cleanup_free_ char *address = NULL;
 
                         if (dot_or_dot_dot(dent->d_name))
                                 continue;
 
-                        r = safe_atou_full(dent->d_name, 10, &i);
+                        r = safe_atoi(dent->d_name, &i);
                         if (r < 0 || i <= 0)
                                 continue;