| lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> | ||||
| 3 | * | ||||
| 4 | * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. | ||||
| 5 | */ | ||||
| 6 | |||||
| 7 | #include <dirent.h> | ||||
| 8 | #include <errno.h> | ||||
| 9 | #include "dirstream.h" | ||||
| 10 | |||||
| 11 | |||||
| 12 | int dirfd(DIR * dir) | ||||
| 13 | { | ||||
| 14 | if (!dir || dir->dd_fd == -1) { | ||||
| 15 | __set_errno(EBADF); | ||||
| 16 | return -1; | ||||
| 17 | } | ||||
| 18 | |||||
| 19 | return dir->dd_fd; | ||||
| 20 | } | ||||
| 21 | libc_hidden_def(dirfd) | ||||