From 19e522049bd1262ed9067f36e98f51dadfcefda8 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sun, 7 Aug 2011 15:13:00 +0200 Subject: [PATCH] Fix missing files in file browser The file browser was throwing away the first two files, assuming they were "." and "..". Alas, this is no longer true on every Linux. Now we actuallyc compare for these names, before skipping them. --- filebrowser/dir.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/filebrowser/dir.c b/filebrowser/dir.c index 40d13fb..ff317e5 100644 --- a/filebrowser/dir.c +++ b/filebrowser/dir.c @@ -121,14 +121,13 @@ SFgetDir(dir) (void) stat(".", &statBuf); dir->mtime = statBuf.st_mtime; - (void) readdir(dirp); /* throw away "." */ + while (dp = readdir(dirp)) { + struct stat statBuf; + if(!strcmp(dp->d_name, ".")) continue; /* Throw away "." */ + if(!strcmp(dp->d_name, "..")) continue; /* Throw away ".." */ #ifndef S_IFLNK - (void) readdir(dirp); /* throw away ".." */ #endif /* ndef S_IFLNK */ - - while (dp = readdir(dirp)) { - struct stat statBuf; if (i >= alloc) { alloc = 2 * (alloc + 1); result = (SFEntry *) XtRealloc((char *) result, -- 1.7.0.4