This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][BZ #16071] Fix file reads for large AF_INET requests from hosts file
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Rich Felker <dalias at aerifal dot cx>
- Cc: Siddhesh Poyarekar <siddhesh at redhat dot com>, libc-alpha at sourceware dot org
- Date: Tue, 22 Oct 2013 15:58:53 +0200
- Subject: Re: [PATCH][BZ #16071] Fix file reads for large AF_INET requests from hosts file
- Authentication-results: sourceware.org; auth=none
- References: <20131022054744 dot GD11038 at spoyarek dot pnq dot redhat dot com> <20131022135356 dot GW20515 at brightrain dot aerifal dot cx>
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.
>
>From C standard:
7.19.7.2 The fgets function
Synopsis
1 #include <stdio.h>
char *fgets(char * restrict s, int n,
FILE * restrict stream);