diff options
-rw-r--r-- | mkfs.jffs2.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c index cdf2a5a..f042ae7 100644 --- a/mkfs.jffs2.c +++ b/mkfs.jffs2.c @@ -276,30 +276,27 @@ static struct filesystem_entry *find_filesystem_entry( e = dir->files; } while (e) { - /* Only bother to do the expensive strcmp on matching file types */ - if (type == (e->sb.st_mode & S_IFMT)) { - if (S_ISDIR(e->sb.st_mode)) { - int len = strlen(e->fullname); - - /* Check if we are a parent of the correct path */ - if (strncmp(e->fullname, fullname, len) == 0) { - /* Is this an _exact_ match? */ - if (strcmp(fullname, e->fullname) == 0) { - return (e); - } - /* Looks like we found a parent of the correct path */ - if (fullname[len] == '/') { - if (e->files) { - return (find_filesystem_entry (e, fullname, type)); - } else { - return NULL; - } - } - } - } else { + if (S_ISDIR(e->sb.st_mode)) { + int len = strlen(e->fullname); + + /* Check if we are a parent of the correct path */ + if (strncmp(e->fullname, fullname, len) == 0) { + /* Is this an _exact_ match? */ if (strcmp(fullname, e->fullname) == 0) { return (e); } + /* Looks like we found a parent of the correct path */ + if (fullname[len] == '/') { + if (e->files) { + return (find_filesystem_entry (e, fullname, type)); + } else { + return NULL; + } + } + } + } else { + if (strcmp(fullname, e->fullname) == 0) { + return (e); } } e = e->next; |