- Subject: ferror() after fread() on a FILE* opened for write
- From: Gurusamy Sarathy <gsar@activestate.com>
- Date: Wed Jul 21 08:32:16 1999
Topics:
ferror() after fread() on a FILE* opened for write
----------------------------------------------------------------------
Date: Tue, 20 Jul 1999 19:41:05 -0700
From: Gurusamy Sarathy <gsar@activestate.com>
To: bug-glibc@gnu.org
cc: gsar@activestate.com
Subject: ferror() after fread() on a FILE* opened for write
Message-Id: <199907210241.TAA27866@activestate.com>
The following little program:
#include <stdio.h>
int
main(int argc, char **argv)
{
char buf;
int r = fread(&buf,1,1,stdout);
printf("%d ferror=%d feof=%d\n", r, ferror(stdout), feof(stdout));
return 0;
}
prints:
0 ferror=0 feof=0
The result is unchanged if I replace stdout with the result of, say,
fopen("/tmp/foo","w").
On a stock Debian 2.1 system with libc-2.0.7.so, this causes one of the
tests in the upcoming Perl development release to fail. I'm inclined to
think it is a glibc bug.
FWIW, ferror() returns non-zero in the above on all other platforms
I've tried.
Sarathy
gsar@activestate.com
------------------------------
End of forwardBcAUri Digest
***************************