diff options
Diffstat (limited to 'libc/misc/dirent/dirfd.c')
-rw-r--r-- | libc/misc/dirent/dirfd.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libc/misc/dirent/dirfd.c b/libc/misc/dirent/dirfd.c new file mode 100644 index 000000000..d401dccd2 --- /dev/null +++ b/libc/misc/dirent/dirfd.c @@ -0,0 +1,12 @@ +#include <errno.h> +#include "dirstream.h" + +int dirfd(DIR * dir) +{ + if (!dir || dir->dd_fd == -1) { + errno = EBADF; + return -1; + } + + return dir->dd_fd; +} |