Bug 597793
Summary: | fileno (NULL) segfaults instead of return -1 and set errno to EBADF | |||
---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Jan F. Chadima <jchadima> | |
Component: | glibc | Assignee: | Andreas Schwab <schwab> | |
Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | |
Severity: | high | Docs Contact: | ||
Priority: | low | |||
Version: | rawhide | CC: | jakub, schwab | |
Target Milestone: | --- | Keywords: | Reopened | |
Target Release: | --- | |||
Hardware: | All | |||
OS: | Linux | |||
Whiteboard: | ||||
Fixed In Version: | Doc Type: | Bug Fix | ||
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 597794 (view as bug list) | Environment: | ||
Last Closed: | 2010-05-31 11:25:18 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: | ||||
Bug Blocks: | 597794 |
Description
Jan F. Chadima
2010-05-30 14:33:56 UTC
NULL is not a pointer to a stream. NULL is the valid return value of fopen &tc.. so NULL can be considered as pointer to unopened stream. NULL is not a pointer to a stream. from fileno man page: ERRORS These functions should not fail and do not set the external variable errno. (However, in case fileno() detects that its argument is not a valid stream, it must return -1 and set errno to EBADF.) Note that EBADF in this case is a MAY FAIL rather than MUST FAIL, so while fileno could return -1/EBADF in that case, it doesn't have to. And slowing the function down to cope with broken callers isn't a good idea. That is irrelevant since NULL is not a pointer to a stream. |