This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/10932] libio use isatty() but don't take care of -ENOTTY
- From: "yann at droneaud dot fr" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 9 Nov 2009 16:59:53 -0000
- Subject: [Bug libc/10932] libio use isatty() but don't take care of -ENOTTY
- References: <20091109164151.10932.yann@droneaud.fr>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From yann at droneaud dot fr 2009-11-09 16:59 -------
Created an attachment (id=4371)
--> (http://sourceware.org/bugzilla/attachment.cgi?id=4371&action=view)
Proposed test case
Here is a test case which try fscanf() and fgetc() on an any filename given as
argument.
Here are some outputs from the test case:
$ ./stdio-errno /dev/null
>>> fscanf() failed: 25 Inappropriate ioctl for device
fscanf() returned EOF
>>> fgetc() failed: 25 Inappropriate ioctl for device
fgetc() returned EOF
$ ./stdio-errno /dev/zero
fscanf() failed to parse anything
>>> fgetc() failed: 25 Inappropriate ioctl for device
fgetc() returned 0 (0x00000000)
In case of error or EOF, fscanf() is supposed to return EOF.
But when reading /dev/null, EOF is returned, but errno is set to something
different than 0, eg ENOTTY. This is not usable to distinguish valid EOF.
When reading /dev/zero, fgetc() return 0 which is OK, but set errno to ENOTTY.
--
http://sourceware.org/bugzilla/show_bug.cgi?id=10932
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.