#include "checker.h"
#include <dirent.h>
#include <errno.h>

#include "chkr_dir.h"

int
chkr_closedir (chkr_DIR * dir)
{
  int fd;

  if (!dir) {
    chkr_errno = EBADF;
    return -1;
  }
  fd = dir->dd_fd;
  sys_free (dir->dd_buf);
  sys_free (dir);
  return close (fd);
}
