Created attachment 397238 [details] bogus.c Description of problem: The attached program demonstrates that if one opens a directory for reading, getc() returns EOF, but feof() doesn't think the file is at EOF. I realize that reading a directory via stdio isn't a very useful operation, but couldn't one expect some consistency here? The consistency failure sends at least one widely-used program into an infinite loop. Version-Release number of selected component (if applicable): glibc-2.10.2-1.x86_64 How reproducible: 100% Steps to Reproduce: 1. Run attached program Actual results: $ ./a.out getc yields -1 feof yields 0 Expected results: If getc yields -1, shouldn't feof yield 1? Additional info: The same behavior was reported to me by someone running CentOS 5.2 on x86_64, so I suspect it affects many versions of glibc.
The program is bogus, you didn't check ferror.
If it's not going to let me read, why didn't the fopen fail?