Project

General

Profile

Bug #999 ยป seekdir.diff

mbalmer, 05/02/2008 09:14 AM

View differences:

readdir.c Fri May 2 10:27:18 2008
* get next entry in a directory.
*/
struct dirent *
_readdir_unlocked(DIR *dirp)
_readdir_unlocked(DIR *dirp, int skipdeleted)
{
struct dirent *dp;
long dummy;
......
if (_DIRENT_DIRSIZ(dp) > dirp->dd_len + 1 - dirp->dd_loc)
return (NULL);
dirp->dd_loc += _DIRENT_DIRSIZ(dp);
if (dp->d_ino == 0)
if (dp->d_ino == 0 && skipdeleted)
continue;
if (dp->d_type == DT_WHT && (dirp->dd_flags & DTF_HIDEW))
continue;
......
if (__isthreaded)
_pthread_mutex_lock((pthread_mutex_t *)&dirp->dd_lock);
dp = _readdir_unlocked(dirp);
dp = _readdir_unlocked(dirp, 0);
if (__isthreaded)
_pthread_mutex_unlock((pthread_mutex_t *)&dirp->dd_lock);
......
errno = 0;
if (__isthreaded)
_pthread_mutex_lock((pthread_mutex_t *)&dirp->dd_lock);
if ((dp = _readdir_unlocked(dirp)) != NULL)
if ((dp = _readdir_unlocked(dirp, 0)) != NULL)
memcpy(entry, dp, _DIRENT_MINSIZ(dp));
if (__isthreaded)
_pthread_mutex_unlock((pthread_mutex_t *)&dirp->dd_lock);
_pthread_mutex_unlock((pthread_mutex_t *)&dirp->dd_lock, 0);
if (errno != 0) {
if (dp == NULL) {
-- telldir.c.orig Fri May 2 10:25:58 2008
++ telldir.c Fri May 2 10:26:02 2008
......
* load a new buffer or for dd_loc to not match directly.
*/
while (dirp->dd_loc < lp->loc_loc && dirp->dd_seek == lp->loc_seek) {
dp = _readdir_unlocked(dirp);
dp = _readdir_unlocked(dirp, 1);
if (dp == NULL)
break;
}
    (1-1/1)