udev-builtin-net_id: skip non-directory entry earlier

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.
This commit is contained in:
Yu Watanabe
2023-08-01 09:26:15 +09:00
parent 14faf7235a
commit 4103dca1b5
+3
View 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;