summaryrefslogtreecommitdiff
path: root/libio/fileno.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-07-08 11:59:45 +0000
committerUlrich Drepper <drepper@redhat.com>1999-07-08 11:59:45 +0000
commit110215a9a76594e808903af957f3273e3bc11a87 (patch)
tree36ffca48f1168e282af19e00d3909597a5573dff /libio/fileno.c
parent94e365c61202e2472c8aea42c7c95ce40f5b843c (diff)
Update.
1999-07-08 Andreas Schwab <schwab@suse.de> * libio/iofopncook.c (fopencookie): Set _fileno to -2. * libio/libioP.h (_IO_file_is_open): Only check for -1, not all negative numbers. * libio/fileops.c (_IO_new_file_close_it): Set _fileno to -1, not EOF. * libio/oldfileops.c (_IO_old_file_close_it): Likewise. 1999-07-08 Andreas Schwab <schwab@suse.de> * stdio-common/vfprintf.c (buffered_vfprintf): Initialize _mode. 1999-07-08 Andreas Schwab <schwab@suse.de> * libio/fileno.c: Return -1 instead of EOF and set errno if the stream is not a real file stream. 1999-07-08 Andreas Schwab <schwab@suse.de> * manual/charset.texi: Fix typos.
Diffstat (limited to 'libio/fileno.c')
-rw-r--r--libio/fileno.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libio/fileno.c b/libio/fileno.c
index 7ff93e6a81..92334f1564 100644
--- a/libio/fileno.c
+++ b/libio/fileno.c
@@ -32,8 +32,11 @@ fileno (fp)
{
CHECK_FILE (fp, EOF);
- if (!(fp->_flags & _IO_IS_FILEBUF))
- return EOF;
+ if (!(fp->_flags & _IO_IS_FILEBUF) || _IO_fileno (fp) < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
return _IO_fileno (fp);
}