[PATCH][BZ #16071] Fix file reads for large AF_INET requests from hosts file
Siddhesh Poyarekar
siddhesh@redhat.com
Tue Oct 22 13:59:00 GMT 2013
On Tue, Oct 22, 2013 at 09:53:56AM -0400, Rich Felker wrote:
> On Tue, Oct 22, 2013 at 11:17:44AM +0530, Siddhesh Poyarekar wrote:
> > +/* Hack around the fact that fgets only accepts integer sizes. */
> > +static char *
> > +get_contents (char *linebuf, size_t len, FILE *stream)
>
> What is the purpose of this function? The comment is clearly incorrect
> in terms of the API contract for fgets, so if glibc fgets is failing
> for arguments larger than INT_MAX, this is a bug in glibc's fgets
> implementastion that needs to be fixed, not something to work around
> in a wrapper.
fgets is defined[1] as:
char *fgets(char *restrict s, int n, FILE *restrict stream);
so it is not a glibc fgets bug - the standard definition is screwed
up.
Siddhesh
[1] http://pubs.opengroup.org/onlinepubs/007904975/functions/fgets.html
More information about the Libc-alpha
mailing list