1
0
Fork 0

fix for non-standard opendir() on reiserfs

This commit is contained in:
bagyenda 2005-05-11 05:51:57 +00:00
parent b45bd9059e
commit 38e36613c9
2 changed files with 50 additions and 44 deletions

View File

@ -846,8 +846,14 @@ static int run_dir(char *topdir, char *dir, struct Qthread_t *tlist, int num_thr
goto done;
}
while ((dp = readdir(dirp)) != NULL)
if ((dp->d_type & DT_REG) &&
while ((dp = readdir(dirp)) != NULL) {
struct stat st;
Octstr *xfname = octstr_format("%s%s", xdir, dp->d_name);
int sres = stat(octstr_get_cstr(xfname), &st);
octstr_destroy(xfname);
if (sres == 0 && S_ISREG(st.st_mode) &&
dp->d_name[0] == MQF &&
dp->d_name[1] == 'f') {
Octstr *xqf = xmake_qf(dp->d_name, dir);
@ -881,12 +887,13 @@ static int run_dir(char *topdir, char *dir, struct Qthread_t *tlist, int num_thr
} else
free_envelope(e,0); /* Let go of it. */
} else if ((dp->d_type & DT_DIR) &&
} else if (sres == 0 && S_ISDIR(st.st_mode) &&
strcmp(dp->d_name, ".") != 0 &&
strcmp(dp->d_name, "..") != 0) {
Octstr *newdir = octstr_format("%s%s/", dir, dp->d_name);
list_append(stack, newdir); /* push it... */
}
}
if (dirp) closedir(dirp);
done:
if (tdir)

View File

@ -391,8 +391,7 @@ static int mms_load_ua_profile_cache(char *dir)
if (strcmp(dp->d_name, ".") == 0 ||
strcmp(dp->d_name, "..") == 0 ||
dp->d_type & DT_DIR) /* If a directory, keep going. */
strcmp(dp->d_name, "..") == 0) /* A directory, skip. */
continue;
fname = octstr_format("%.255s/%.254s", dir, dp->d_name);