summaryrefslogtreecommitdiff
path: root/lib/libc/dirent/opendir.c
blob: 6a5d3b5d1070043c7cbe72ace735de31b3293397 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <dirent.h> // for fdopendir, DIR, opendir
#include <fcntl.h>  // for open, O_RDONLY
#include <stddef.h> // for NULL

DIR *opendir(const char *dirname)
{
	int fildes = open(dirname, O_RDONLY);

	if (fildes < 0)
		return NULL;

	return fdopendir(fildes);
}