aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2015-12-01 20:47:48 +0100
committerGene Cumm <gene.cumm@gmail.com>2015-12-06 15:18:50 -0500
commita35e34b7fa47a62df711c49832f46d6edf790381 (patch)
treed7f8670c05db2e46db971acef55ea4f8314efe28 /com32
parent7d70885d22e4474407637026c1af12a253281407 (diff)
downloadsyslinux-a35e34b7fa47a62df711c49832f46d6edf790381.tar.gz
syslinux-a35e34b7fa47a62df711c49832f46d6edf790381.tar.xz
syslinux-a35e34b7fa47a62df711c49832f46d6edf790381.zip
com32: Handle broken modules.alias
When parsing the modules.alias, we shall report it as broken if we cannot find any valid line in it. This patch simply count the number of valid lines and report a missing modules.alias if no valid lines are found.
Diffstat (limited to 'com32')
-rw-r--r--com32/lib/pci/scan.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/com32/lib/pci/scan.c b/com32/lib/pci/scan.c
index fe00fc25..20a3e2a6 100644
--- a/com32/lib/pci/scan.c
+++ b/com32/lib/pci/scan.c
@@ -603,6 +603,7 @@ int get_module_name_from_alias(struct pci_domain *domain, char *modules_alias_pa
char sub_product_id[16];
FILE *f;
struct pci_device *dev=NULL;
+ int valid_lines=0;
/* Intializing the linux_kernel_module for each pci device to "unknown" */
/* adding a dev_info member if needed */
@@ -630,6 +631,7 @@ int get_module_name_from_alias(struct pci_domain *domain, char *modules_alias_pa
if ((line[0] == '#') || (strstr(line,"alias pci:v")==NULL))
continue;
+ valid_lines++;
/* Resetting temp buffer*/
memset(module_name,0,sizeof(module_name));
memset(vendor_id,0,sizeof(vendor_id));
@@ -725,5 +727,11 @@ int get_module_name_from_alias(struct pci_domain *domain, char *modules_alias_pa
}
}
fclose(f);
+ /* If no valid line was found in the module.alias,
+ * we shall report it as broken/empty/non-existing */
+ if (valid_lines == 0) {
+ return -ENOMODULESALIAS;
+ }
+
return 0;
}