Back to index

glibc  2.9
closedir.c File Reference
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
#include <dirent.h>
#include <unistd.h>
#include <dirstream.h>
#include <not-cancel.h>

Go to the source code of this file.


int __closedir (DIR *dirp)

Function Documentation

int __closedir ( DIR *  dirp)

Definition at line 32 of file closedir.c.

  int fd;

  if (dirp == NULL)
      __set_errno (EINVAL);
      return -1;

  /* We do not try to synchronize access here.  If some other thread
     still uses this handle it is a big mistake and that thread
     deserves all the bad data it gets.  */

  fd = dirp->fd;

#ifndef NOT_IN_libc
  __libc_lock_fini (dirp->lock);

  free ((void *) dirp);

  return close_not_cancel (fd);