diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2008-05-19 11:50:48 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2008-05-19 11:50:48 +0000 |
| commit | e4d730f133f2369108d97a0a99d6cbd6ae62b069 (patch) | |
| tree | 882f197580833461d75839e5ccc40902156820ae /lib/libc | |
| parent | 3c7e221bc51c389780b45c3f7809115f88b2c6b3 (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/gen/readdir.c | 13 | ||||
| -rw-r--r-- | lib/libc/gen/telldir.c | 2 | ||||
| -rw-r--r-- | lib/libc/gen/telldir.h | 2 |
3 files changed, 9 insertions, 8 deletions
diff --git a/lib/libc/gen/readdir.c b/lib/libc/gen/readdir.c index 68d0ddd663853..95333765df03c 100644 --- a/lib/libc/gen/readdir.c +++ b/lib/libc/gen/readdir.c @@ -51,8 +51,9 @@ __FBSDID("$FreeBSD$"); * get next entry in a directory. */ struct dirent * -_readdir_unlocked(dirp) +_readdir_unlocked(dirp, skip) DIR *dirp; + int skip; { struct dirent *dp; @@ -75,7 +76,7 @@ _readdir_unlocked(dirp) dp->d_reclen > dirp->dd_len + 1 - dirp->dd_loc) return (NULL); dirp->dd_loc += dp->d_reclen; - if (dp->d_ino == 0) + if (dp->d_ino == 0 && skip) continue; if (dp->d_type == DT_WHT && (dirp->dd_flags & DTF_HIDEW)) continue; @@ -91,11 +92,11 @@ readdir(dirp) if (__isthreaded) { _pthread_mutex_lock((pthread_mutex_t *)&dirp->dd_lock); - dp = _readdir_unlocked(dirp); + dp = _readdir_unlocked(dirp, 1); _pthread_mutex_unlock((pthread_mutex_t *)&dirp->dd_lock); } else - dp = _readdir_unlocked(dirp); + dp = _readdir_unlocked(dirp, 1); return (dp); } @@ -112,11 +113,11 @@ readdir_r(dirp, entry, result) errno = 0; if (__isthreaded) { _pthread_mutex_lock((pthread_mutex_t *)&dirp->dd_lock); - if ((dp = _readdir_unlocked(dirp)) != NULL) + if ((dp = _readdir_unlocked(dirp, 1)) != NULL) memcpy(entry, dp, _GENERIC_DIRSIZ(dp)); _pthread_mutex_unlock((pthread_mutex_t *)&dirp->dd_lock); } - else if ((dp = _readdir_unlocked(dirp)) != NULL) + else if ((dp = _readdir_unlocked(dirp, 1)) != NULL) memcpy(entry, dp, _GENERIC_DIRSIZ(dp)); if (errno != 0) { diff --git a/lib/libc/gen/telldir.c b/lib/libc/gen/telldir.c index 170e547443121..07ad469145b6b 100644 --- a/lib/libc/gen/telldir.c +++ b/lib/libc/gen/telldir.c @@ -102,7 +102,7 @@ _seekdir(dirp, loc) dirp->dd_seek = lp->loc_seek; dirp->dd_loc = 0; while (dirp->dd_loc < lp->loc_loc) { - dp = _readdir_unlocked(dirp); + dp = _readdir_unlocked(dirp, 0); if (dp == NULL) break; } diff --git a/lib/libc/gen/telldir.h b/lib/libc/gen/telldir.h index 4fb4cb6ca8aa9..ef930d2b80b7c 100644 --- a/lib/libc/gen/telldir.h +++ b/lib/libc/gen/telldir.h @@ -59,7 +59,7 @@ struct _telldir { long td_loccnt; /* index of entry for sequential readdir's */ }; -struct dirent *_readdir_unlocked(DIR *); +struct dirent *_readdir_unlocked(DIR *, int); void _reclaim_telldir(DIR *); void _seekdir(DIR *, long); |
