[PATCH] Prevent gcc error on isys/eddsupport.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Getting this on eddsupport.c with latest gcc:
eddsupport.c:171: error: offset ‘3’ outside bounds of constant string

gcc does not like the "." and ".." in strncmp() calls.  Do the same
thing but without calling strncmp() and without declaring temporary
variables.
---
 isys/eddsupport.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/isys/eddsupport.c b/isys/eddsupport.c
index ae974c5..67e22c7 100644
--- a/isys/eddsupport.c
+++ b/isys/eddsupport.c
@@ -168,9 +168,16 @@ static int mapBiosDisks(struct device** devices,const char *path) {
     }
 
     while ((entry = readdir(dirHandle)) != NULL) {
-        if(!strncmp(entry->d_name,".",1) || !strncmp(entry->d_name,"..",2)) {
-            continue;
+        if (strlen(entry->d_name) == 1) {
+            if (entry->d_name[0] == '.') {
+                continue;
+            }
+        } else if (strlen(entry->d_name) == 2) {
+            if (entry->d_name[0] == '.' && entry->d_name[1] == '.') {
+                continue;
+            }
         }
+
         ret = sscanf((entry->d_name+9), "%x", &biosNum);
         
         sigFileName = malloc(strlen(path) + strlen(entry->d_name) + 20);
-- 
1.6.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux