Bug 6284 - fclose(NULL) causes segmentation error
Summary: fclose(NULL) causes segmentation error
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: libc
Version: 5.2
Hardware: i386
OS: Linux
high
high
Target Milestone: ---
Assignee: Cristian Gafton
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-10-23 10:49 UTC by Andrew Wiseman
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-01-06 21:07:18 UTC
Embargoed:


Attachments (Terms of Use)

Description Andrew Wiseman 1999-10-23 10:49:56 UTC
When I compile and run the example program shown below,
under RedHat Linux 5.2 (Kernel 2.0.36) with gcc
(v2.7.2.3), I get a segmentation error. The same code has
been run on many other Unix systems and even other versions
of Linux without failure. Granted fclose(NULL) is not a
useful thing to do, but nevertheless it should not cause a
segmentation error.

main()
{
     long *file_rep = 0x0;
     fclose(file_rep);
}

Comment 1 Cristian Gafton 2000-01-06 21:07:59 UTC
This is a programming error. POSIX says that the behavior is unspecified. And
glibc segfaults to signal a major error in a program, and it is also withing
POSIX's specification.


Note You need to log in before you can comment on or make changes to this bug.