diff --git a/utils/fwparam_ibft/fwparam_ibft_sysfs.c b/utils/fwparam_ibft/fwparam_ibft_sysfs.c index 98e29a6..e44460d 100644 --- a/utils/fwparam_ibft/fwparam_ibft_sysfs.c +++ b/utils/fwparam_ibft/fwparam_ibft_sysfs.c @@ -80,7 +80,7 @@ static int find_sysfs_dirs(const char *fpath, const struct stat *sb, static int get_iface_from_device(char *id, struct boot_context *context) { char dev_dir[FILENAMESZ]; - int rc = ENODEV; + int rc = EOPNOTSUPP; DIR *dirfd; struct dirent *dent; @@ -95,8 +95,7 @@ static int get_iface_from_device(char *id, struct boot_context *context) return errno; while ((dent = readdir(dirfd))) { - if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..") || - strncmp(dent->d_name, "net", 3)) + if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) continue; if (!strncmp(dent->d_name, "net:", 4)) { @@ -112,17 +111,19 @@ static int get_iface_from_device(char *id, struct boot_context *context) rc = EINVAL; rc = 0; break; - } else { - printf("Could not read ethernet to net link\n."); - rc = EOPNOTSUPP; + } + if (!strcmp(dent->d_name, "net")) { + rc = ENODEV; break; } } closedir(dirfd); - if (rc != ENODEV) + if (rc != ENODEV) { + printf("Could not read ethernet to net link\n."); return rc; + } /* If not found try again with newer kernel networkdev sysfs layout */ strlcat(dev_dir, "/net", FILENAMESZ);