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

Is this a bug in libc6?



Hi,

try running the following simple program:

#include <stdio.h>

void main(void)
{
        FILE *fp;

        fp = fopen("file.txt", "r");
        fclose(fp);
        fclose(fp);
}

You'll see that it generates a segmentation fault and dumps core in 
libc's code.

Try with an existing file.txt (touch file.txt) and later without a
file.txt (rm file.txt). In both cases it'll crash in fclose() (which
one depends on whether file.txt exists or not).

Can you reproduce this problem? If you can, then can you tell me if
fclose() is supposed to behave that way?

According to fclose's man page, it will return EOF and set errno to
EBADF if the argument is not an open stream.

Under libc5 is seems to crash only if file.txt does not exist.

Am I missing something here? Should I consider this a bug in libc?

This whole thing has made me waste a couple of days tracking down a
problem in the HylaFAX fax server <sigh> :-)

Thanks,

E.-

-- 

Eloy A. Paris
Information Technology Department
Rockwell Automation de Venezuela
Telephone: +58-2-9432311 Fax: +58-2-9431645


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: