summaryrefslogtreecommitdiff
path: root/src/dirent/closedir.c
blob: 558fe2280f35cc2b1f61f977a9f7cb427d8e6460 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <dirent.h>
#include "sys/types.h"
#include "unistd.h"
#include "stdlib.h"
#include "_assert.h"
#include "_dirent.h"

int closedir(DIR *dirp)
{
	int ret = -1;
	ASSERT_NONNULL(dirp);
	ret = close(dirp->fd);
	if (ret != -1) {
		free(dirp);
	}
	return ret;
}
/*
POSIX(1)
*/