dirfd.c 180 B

12345678910111213
  1. #include <dirent.h>
  2. #include <errno.h>
  3. #include "dirstream.h"
  4. int dirfd(DIR * dir)
  5. {
  6. if (!dir || dir->dd_fd == -1) {
  7. __set_errno(EBADF);
  8. return -1;
  9. }
  10. return dir->dd_fd;
  11. }