[syslinux:master] com32: Handle broken modules.alias

syslinux-bot for Erwan Velu erwanaliasr1 at gmail.com
Tue Dec 8 16:27:03 PST 2015


Commit-ID:  a35e34b7fa47a62df711c49832f46d6edf790381
Gitweb:     http://www.syslinux.org/commit/a35e34b7fa47a62df711c49832f46d6edf790381
Author:     Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Tue, 1 Dec 2015 20:47:48 +0100
Committer:  Gene Cumm <gene.cumm at gmail.com>
CommitDate: Sun, 6 Dec 2015 15:18:50 -0500

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.

---
 com32/lib/pci/scan.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/com32/lib/pci/scan.c b/com32/lib/pci/scan.c
index fe00fc2..20a3e2a 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;
 }


More information about the Syslinux-commits mailing list