Rev 4874 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4874 | Rev 4921 | ||
---|---|---|---|
Line 45... | Line 45... | ||
45 | Supporting OS subroutines required: none. |
45 | Supporting OS subroutines required: none. |
46 | */ |
46 | */ |
Line 47... | Line 47... | ||
47 | 47 | ||
48 | #include <_ansi.h> |
48 | #include <_ansi.h> |
- | 49 | #include |
|
49 | #include |
50 | #include |
Line 50... | Line 51... | ||
50 | #include "local.h" |
51 | #include "local.h" |
51 | 52 | ||
52 | int |
53 | int |
53 | _DEFUN(fileno, (f), |
54 | _DEFUN(fileno, (f), |
54 | FILE * f) |
55 | FILE * f) |
55 | { |
56 | { |
56 | int result; |
57 | int result; |
- | 58 | CHECK_INIT (_REENT, f); |
|
57 | CHECK_INIT (_REENT, f); |
59 | _newlib_flockfile_start (f); |
- | 60 | if (f->_flags) |
|
- | 61 | result = __sfileno (f); |
|
- | 62 | else |
|
- | 63 | { |
|
- | 64 | result = -1; |
|
58 | _flockfile (f); |
65 | _REENT->_errno = EBADF; |
59 | result = __sfileno (f); |
66 | } |
60 | _funlockfile (f); |
67 | _newlib_flockfile_end (f); |