fopen(NULL) causes segmentation fault
Mo McKinlay
mmckinlay@labs.interopen.org
Tue Mar 28 10:24:00 GMT 2000
# main()
# {
# long *file_rep = 0x0;
# fclose(file_rep);
# }
The fclose() function is provided by the C library, not by the compiler,
which is why Linux platforms cause a segmentation fault, and other
platforms do not (you may find that they set errno to EFAULT in this
case). In any case, you should take up the issue with the glibc people if
you believe the behaviour is incorrect.
Incidentally, you might find this useful: (taken from "(libc.info)Error
Codes"
- Macro: int EFAULT
Bad address; an invalid pointer was detected. In the GNU system,
this error never happens; you get a signal instead.
--
Mo McKinlay Chief Software Architect inter/open
mmckinlay@labs.interopen.org http://www.interopen.org
More information about the Gcc-bugs
mailing list