summaryrefslogtreecommitdiff
path: root/test/misc/tst-scandir.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/misc/tst-scandir.c')
-rw-r--r--test/misc/tst-scandir.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/misc/tst-scandir.c b/test/misc/tst-scandir.c
new file mode 100644
index 000000000..6e4646142
--- /dev/null
+++ b/test/misc/tst-scandir.c
@@ -0,0 +1,21 @@
+#include <dirent.h>
+#include <errno.h>
+
+int skip_all(const struct dirent *dirbuf)
+{
+ __set_errno(EBADF);
+ return 0;
+}
+
+int main()
+{
+ struct dirent **namelist;
+ int n;
+
+ n = scandir(".", &namelist, skip_all, 0);
+ if (n < 0) {
+ perror("scandir");
+ return 1;
+ }
+ return 0;
+}