Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37750290
en ru br
ALT Linux repos
S:B.02.19.2-alt2.1
5.0: 2.13-alt2
4.1: 2.12-alt1
4.0: 2.10-alt1
3.0: 2.05-alt1

Group :: System/Kernel and hardware
RPM: lshw

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: lshw-B.02.18-scandir.patch
Download


diff --git a/src/core/abi.cc b/src/core/abi.cc
index 76c664c..b5bd9c9 100644
--- a/src/core/abi.cc
+++ b/src/core/abi.cc
@@ -36,13 +36,15 @@ bool scan_abi(hwNode & system)
     struct dirent **namelist;
 
     n = scandir(".", &namelist, selectfile, alphasort);
-    for(i=0; i<n; i++)
-    {
-      system.addCapability(namelist[i]->d_name);
-      free(namelist[i]);
+    if (n > 0) {
+      for(i=0; i<n; i++)
+	{
+	  system.addCapability(namelist[i]->d_name);
+	  free(namelist[i]);
+	}
+      if(namelist)
+	free(namelist);
     }
-    if(namelist)
-      free(namelist);
   }
 
   popd();
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin