summaryrefslogtreecommitdiff
path: root/src/udev/udev-builtin-net_id.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-08-27 17:36:22 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-08-31 21:18:49 +0900
commitba86989fcdc974a6c3729ae78041ba3739f44d5e (patch)
treedddb84661d0f7df03141a537ce0e4a6c24868ed5 /src/udev/udev-builtin-net_id.c
parent4154524d47d24bcee3ebfed939912a847ebeb1b3 (diff)
downloadsystemd-ba86989fcdc974a6c3729ae78041ba3739f44d5e.tar.gz
udev: drop redundant chase_symlinks()
`sd_device_new_from_syspath()` internally calls chase_symlinks().
Diffstat (limited to 'src/udev/udev-builtin-net_id.c')
-rw-r--r--src/udev/udev-builtin-net_id.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 9578fa00c3..80c57e287d 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -99,8 +99,7 @@ static sd_device *skip_virtio(sd_device *dev) {
static int get_virtfn_info(sd_device *dev, struct netnames *names, struct virtfn_info *ret) {
_cleanup_(sd_device_unrefp) sd_device *physfn_pcidev = NULL;
- const char *physfn_link_file, *syspath;
- _cleanup_free_ char *physfn_pci_syspath = NULL;
+ const char *physfn_syspath, *syspath;
struct dirent *dent;
_cleanup_closedir_ DIR *dir = NULL;
char suffix[ALTIFNAMSIZ];
@@ -114,19 +113,18 @@ static int get_virtfn_info(sd_device *dev, struct netnames *names, struct virtfn
if (r < 0)
return r;
- /* Check if this is a virtual function. */
- physfn_link_file = strjoina(syspath, "/physfn");
- r = chase_symlinks(physfn_link_file, NULL, 0, &physfn_pci_syspath, NULL);
+ /* Get physical function's pci device. */
+ physfn_syspath = strjoina(syspath, "/physfn");
+ r = sd_device_new_from_syspath(&physfn_pcidev, physfn_syspath);
if (r < 0)
return r;
- /* Get physical function's pci device. */
- r = sd_device_new_from_syspath(&physfn_pcidev, physfn_pci_syspath);
+ r = sd_device_get_syspath(physfn_pcidev, &physfn_syspath);
if (r < 0)
return r;
/* Find the virtual function number by finding the right virtfn link. */
- dir = opendir(physfn_pci_syspath);
+ dir = opendir(physfn_syspath);
if (!dir)
return -errno;
@@ -136,7 +134,7 @@ static int get_virtfn_info(sd_device *dev, struct netnames *names, struct virtfn
if (!startswith(dent->d_name, "virtfn"))
continue;
- virtfn_link_file = path_join(physfn_pci_syspath, dent->d_name);
+ virtfn_link_file = path_join(physfn_syspath, dent->d_name);
if (!virtfn_link_file)
return -ENOMEM;