summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2013-11-06 22:26:15 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2013-11-06 22:26:15 +0000
commitaa7bcf70688e84164749fb5c77210cb9732395fe (patch)
tree2436b5b61f901e4190d37d0efe3685eb5a5f58d2
parentb29b709717070cce0cf7cc9a081a68626676104a (diff)
Nowadays, seekdir(3) doesn't call _readdir_unlocked().
Consequently, the "skipdeleted" argument is always == 1. Remove it, effectively reverting readdir.c rev. 1.14. ok millert@ guenther@
-rw-r--r--lib/libc/gen/readdir.c15
-rw-r--r--lib/libc/gen/readdir_r.c6
2 files changed, 7 insertions, 14 deletions
diff --git a/lib/libc/gen/readdir.c b/lib/libc/gen/readdir.c
index 6713f4fbd37..c43a25c9ea7 100644
--- a/lib/libc/gen/readdir.c
+++ b/lib/libc/gen/readdir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readdir.c,v 1.19 2013/10/06 17:57:54 guenther Exp $ */
+/* $OpenBSD: readdir.c,v 1.20 2013/11/06 22:26:14 schwarze Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -37,7 +37,7 @@
* get next entry in a directory.
*/
int
-_readdir_unlocked(DIR *dirp, struct dirent **result, int skipdeleted)
+_readdir_unlocked(DIR *dirp, struct dirent **result)
{
struct dirent *dp;
@@ -61,14 +61,7 @@ _readdir_unlocked(DIR *dirp, struct dirent **result, int skipdeleted)
return (-1);
}
dirp->dd_loc += dp->d_reclen;
-
- /*
- * When called from seekdir(), we let it decide on
- * the end condition to avoid overshooting: the next
- * readdir call should produce the next non-deleted entry,
- * and we already advanced dd_loc.
- */
- if (dp->d_ino == 0 && skipdeleted)
+ if (dp->d_ino == 0)
continue;
dirp->dd_curpos = dp->d_off;
*result = dp;
@@ -82,7 +75,7 @@ readdir(DIR *dirp)
struct dirent *dp;
_MUTEX_LOCK(&dirp->dd_lock);
- _readdir_unlocked(dirp, &dp, 1);
+ _readdir_unlocked(dirp, &dp);
_MUTEX_UNLOCK(&dirp->dd_lock);
return (dp);
diff --git a/lib/libc/gen/readdir_r.c b/lib/libc/gen/readdir_r.c
index a7fa14c65e2..cd70bd6f1bc 100644
--- a/lib/libc/gen/readdir_r.c
+++ b/lib/libc/gen/readdir_r.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readdir_r.c,v 1.4 2013/09/30 12:02:34 millert Exp $ */
+/* $OpenBSD: readdir_r.c,v 1.5 2013/11/06 22:26:14 schwarze Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,7 +35,7 @@
#include "telldir.h"
#include "thread_private.h"
-int _readdir_unlocked(DIR *, struct dirent **, int);
+int _readdir_unlocked(DIR *, struct dirent **);
int
readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
@@ -43,7 +43,7 @@ readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
struct dirent *dp;
_MUTEX_LOCK(&dirp->dd_lock);
- if (_readdir_unlocked(dirp, &dp, 1) != 0) {
+ if (_readdir_unlocked(dirp, &dp) != 0) {
_MUTEX_UNLOCK(&dirp->dd_lock);
return errno;
}