Bug 190560
Summary: | while does not return null at end of file | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Magnus <magnus-swe> |
Component: | glibc | Assignee: | Jakub Jelinek <jakub> |
Status: | CLOSED NOTABUG | QA Contact: | Brian Brock <bbrock> |
Severity: | high | Docs Contact: | |
Priority: | medium | ||
Version: | 5 | ||
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
URL: | http://mange.dynalias.org/linux/misc/fc5_bug/test_null_while.c | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2006-05-03 21:06:10 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: |
Description
Magnus
2006-05-03 16:03:06 UTC
That testcase is very much broken. You end up calling fgets with the second argument 1. fgets reads at most one less than that number of characters from the stream (i.e. 0) and stores '\0' immediately after the last character stored into the array (i.e. at line[0]). As at most zero characters are read from the stream, you never reach EOF and thus it always returns non-NULL. I guess you meant to pass conf_size+1 to fgets. |