diff --git a/src/sys/include/ubixfs/dirCache.h b/src/sys/include/ubixfs/dirCache.h index 95a2a08..f8fc89c 100644 --- a/src/sys/include/ubixfs/dirCache.h +++ b/src/sys/include/ubixfs/dirCache.h @@ -20,6 +20,6 @@ struct cacheNode * ubixfs_dirCacheFind(struct cacheNode *, char *); struct cacheNode * ubixfs_dirCacheNew(const char *); void ubixfs_dirCacheDelete(struct cacheNode **); -void ubixfs_dirCacheAdd(struct cacheNode *, struct cacheNode *); +struct cacheNode * ubixfs_dirCacheAdd(struct cacheNode *, struct cacheNode *); #endif /* !DIRCACHE_H */ diff --git a/src/sys/ubixfs/dirCache.c b/src/sys/ubixfs/dirCache.c index c064eca..49a946e 100644 --- a/src/sys/ubixfs/dirCache.c +++ b/src/sys/ubixfs/dirCache.c @@ -81,8 +81,9 @@ /* if we're here, then one level of the dir isn't cached */ dirList = (struct directoryEntry *)tmp->info; for (i = 0; i < tmp->dirListEntryCount; i++) { - if (strcmp(dirList[i].fileName, nextDir) != 0) { - ubixfs_dirCacheAdd(tmp, ubixfs_dirCacheNew(dirList[i].fileName)); + if (strcmp(dirList[i].fileName, nextDir) == 0) { + tmp = ubixfs_dirCacheAdd(tmp, ubixfs_dirCacheNew(dirList[i].fileName)); + } /* if */ } /* for */ return NULL; @@ -175,7 +176,7 @@ } /* addNode */ #endif -void +struct cacheNode * ubixfs_dirCacheAdd(struct cacheNode *node, struct cacheNode * newNode) { struct cacheNode * tmp; @@ -190,7 +191,7 @@ node->subDirsHead = newNode; tmp = node->subDirsHead; - return; + return tmp; } /* ubixfs_dirCacheAdd */ /***