Bug 6284 - fclose(NULL) causes segmentation error
fclose(NULL) causes segmentation error
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: libc (Show other bugs)
5.2
i386 Linux
high Severity high
: ---
: ---
Assigned To: Cristian Gafton
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-10-23 06:49 EDT by Andrew Wiseman
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-01-06 16:07:18 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Andrew Wiseman 1999-10-23 06:49:56 EDT
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 16:07:59 EST
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.