This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/21531] New: flose with NULL is SEGV should set errno EFAULT or EBADF
- From: "jg at jguk dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 30 May 2017 02:56:21 +0000
- Subject: [Bug libc/21531] New: flose with NULL is SEGV should set errno EFAULT or EBADF
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=21531
Bug ID: 21531
Summary: flose with NULL is SEGV should set errno EFAULT or
EBADF
Product: glibc
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: jg at jguk dot org
CC: drepper.fsp at gmail dot com
Target Milestone: ---
int fclose(FILE *fp);
ERRORS
EBADF
The file descriptor underlying fp is not valid.
Current glibc doesn't follow POSIX. It causes segmentation violation (SEGV)
Should simply do
if(NULL == fp)
{
errno = EBADF;
return -1;
}
--
You are receiving this mail because:
You are on the CC list for the bug.