blob: 873364c27375ff5c9844c172771bb7b4c181c2b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include <__dirent.h> // for __DIR
#include <dirent.h> // for DIR, closedir
#include <errno.h> // for EBADF, errno
#include <stdlib.h> // for free
#include <unistd.h> // for close
int closedir(DIR *dirp)
{
struct __DIR *rdirp = (struct __DIR *)dirp;
if (rdirp->fildes >= 0) {
errno = EBADF;
return -1;
}
close(rdirp->fildes);
free(rdirp);
return 0;
}
|