This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/21531] New: flose with NULL is SEGV should set errno EFAULT or EBADF


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]