[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#626983: ferror(): return no error when the stream is closed



Package: libc6
Version: 2.11.2-10
Severity: normal

Hi, 
As described in the subject, the ferror() function return no error even if the stream as been previously closed : 

Here is a simple program to test this : 

#include <stdio.h>

void main()
{
	FILE * f;
	f=fopen("test","r");
	printf("First -> %d\n",ferror(f));
	fclose(f);
	printf("Second -> %d\n",ferror(f));
	
}

with a file named "test" in the same directory as this program ( the file can be empty )
The execution of this program show this : 

root@debian:~# gcc -o test_ferror test_ferror.c
root@debian:~# ./test_ferror 
First -> 0
Second -> 0

The result of the second output should'nt be 1 ? 

Regards

Julien GODIN


-- System Information:
Debian Release: 6.0.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libc6 depends on:
ii  libc-bin                      2.11.2-10  Embedded GNU C Library: Binaries
ii  libgcc1                       1:4.4.5-8  GCC support library

Versions of packages libc6 recommends:
ii  libc6-i686                    2.11.2-10  Embedded GNU C Library: Shared lib

Versions of packages libc6 suggests:
ii  debconf [debconf-2.0]         1.5.36.1   Debian configuration management sy
pn  glibc-doc                     <none>     (no description available)
ii  locales                       2.11.2-10  Embedded GNU C Library: National L

-- debconf information:
  glibc/restart-services:
  glibc/disable-screensaver:
  glibc/restart-failed:
  glibc/upgrade: true



Reply to: