summaryrefslogtreecommitdiff
path: root/src/dirent/closedir.c
blob: 2852341169dd019597abfc9ce5d1b872861453a2 (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)
*/