[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] Prevent gcc error on isys/eddsupport.c
- From: David Cantrell <dcantrell redhat com>
- To: anaconda-devel-list redhat com
- Cc:
- Subject: [PATCH] Prevent gcc error on isys/eddsupport.c
- Date: Mon, 30 Mar 2009 11:36:19 -1000
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
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]