summaryrefslogtreecommitdiff
path: root/test/misc/tst-scandir.c
blob: 6e464614265fad7cd9a8182b9e6e816401d8c283 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
}