OSDN Git Service

hidden_def/hidden_proto: convert all users (I hope) termios split, add some missing...
[uclinux-h8/uClibc.git] / libc / misc / dirent / dirfd.c
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 int dirfd(DIR * dir)
12 {
13         if (!dir || dir->dd_fd == -1) {
14                 __set_errno(EBADF);
15                 return -1;
16         }
17
18         return dir->dd_fd;
19 }
20 libc_hidden_proto(dirfd)
21 libc_hidden_def(dirfd)