]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev-builtin-net_id: skip non-directory entry earlier
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 31 Jul 2023 18:22:57 +0000 (03:22 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 1 Aug 2023 00:26:15 +0000 (09:26 +0900)
In the below, we will try to read 'address' file in the directory,
hence the entry must be a directory.

No functional change, just a tiny optimization.

src/udev/udev-builtin-net_id.c

index a1aba19cba1a33eacef9705bc0055faa6518331b..76deb254c539b4bd2a0e0f9f34f48c304c4cbf52 100644 (file)
@@ -429,6 +429,9 @@ static int dev_pci_slot(sd_device *dev, const LinkInfo *info, NetNames *names) {
                         if (dot_or_dot_dot(de->d_name))
                                 continue;
 
+                        if (de->d_type != DT_DIR)
+                                continue;
+
                         r = safe_atou32(de->d_name, &i);
                         if (r < 0 || i <= 0)
                                 continue;