summaryrefslogtreecommitdiff
path: root/src/remove.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-04-18 13:14:25 +0000
committerJim Meyering <jim@meyering.net>2004-04-18 13:14:25 +0000
commitd1932b917a257f1a359905a0290697884ef232e8 (patch)
tree995fac57ca9d404f95dcc915acb4175fce130229 /src/remove.c
parent1b195e0bd2e1bd46ed0a984c52f3a71d62c873ee (diff)
downloadcoreutils-d1932b917a257f1a359905a0290697884ef232e8.tar.xz
(readdir_ignoring_dotdirs): Move function to system.h, renaming it. Update uses.
Diffstat (limited to 'src/remove.c')
-rw-r--r--src/remove.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/remove.c b/src/remove.c
index 0e9c3e34d..4672e8a93 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -502,18 +502,6 @@ AD_is_removable (Dirstack_state const *ds, char const *file)
return ! (top->unremovable && hash_lookup (top->unremovable, file));
}
-/* A wrapper for readdir so that callers don't see entries for `.' or `..'. */
-static struct dirent const *
-readdir_ignoring_dotdirs (DIR *dirp)
-{
- while (1)
- {
- struct dirent const *dp = readdir (dirp);
- if (dp == NULL || ! DOT_OR_DOTDOT (dp->d_name))
- return dp;
- }
-}
-
/* Return nonzero if DIR is determined to be an empty directory
or if opendir or readdir fails. */
static bool
@@ -527,7 +515,7 @@ is_empty_dir (char const *dir)
return false;
errno = 0;
- dp = readdir_ignoring_dotdirs (dirp);
+ dp = readdir_ignoring_dot_and_dotdot (dirp);
saved_errno = errno;
closedir (dirp);
if (dp != NULL)
@@ -829,7 +817,7 @@ remove_cwd_entries (Dirstack_state *ds, char **subdir, struct stat *subdir_sb,
/* Set errno to zero so we can distinguish between a readdir failure
and when readdir simply finds that there are no more entries. */
errno = 0;
- if ((dp = readdir_ignoring_dotdirs (dirp)) == NULL)
+ if ((dp = readdir_ignoring_dot_and_dotdot (dirp)) == NULL)
{
if (errno)
{