Bug 597794

Summary: fileno (NULL) segfaults instead of return -1 and set errno to EBADF
Product: Red Hat Enterprise Linux 6 Reporter: Jan F. Chadima <jchadima>
Component: glibcAssignee: Andreas Schwab <schwab>
Status: CLOSED NOTABUG QA Contact: qe-baseos-tools-bugs
Severity: high Docs Contact:
Priority: low    
Version: 6.0CC: fweimer, jakub, schwab
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 597793 Environment:
Last Closed: 2010-05-31 08:32:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 597793    
Bug Blocks:    

Description Jan F. Chadima 2010-05-30 14:36:27 UTC
+++ This bug was initially created as a clone of Bug #597793 +++

Description of problem:
the function fileno crash the program, if called with NULL parameter
according to the documentation it should return -1 and set errno

Version-Release number of selected component (if applicable):
glibc-2.12.90-1.i686

How reproducible:
alvays

Steps to Reproduce:
compille and run:
#include <stdio.h>

int
main()
{
printf ("%d\n", fileno (NULL));
}
  
Actual results:
SIGSEGV

Expected results:
-1

Comment 2 Andreas Schwab 2010-05-31 08:32:38 UTC
NULL is not a pointer to a stream.