On 25.08.2016 17:50, Ingo Schwarze wrote:
> I strongly feel that fgetln(3) ought to behave the same: either
> succeed or fail.  It should not return a string but set errno and
> __SERR at the same time.  So i'd very much like to commit my fgetln.c
> patch.  I have an OK from millert@, which is sufficient for commit
> in OpenBSD.  Do you still object, given the above results and
> arguments?

Well, NetBSD implements fgetln() through getdelim() which fails on
partial line errors. Assuming your fgetln() fix below will be committed
to OpenBSD, I agree to make corresponding change in FreeBSD and do
something for fgetwln() too.

> 
> Index: fgetln.c
> ===================================================================
> RCS file: /cvs/src/lib/libc/stdio/fgetln.c,v
> retrieving revision 1.14
> diff -u -r1.14 fgetln.c
> --- fgetln.c  31 Aug 2015 02:53:57 -0000      1.14
> +++ fgetln.c  25 Aug 2016 14:45:08 -0000
> @@ -115,8 +115,11 @@
>               (void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p,
>                   len - off);
>               off = len;
> -             if (__srefill(fp))
> -                     break;  /* EOF or error: return partial line */
> +             if (__srefill(fp)) {
> +                     if (fp->_flags & __SEOF)
> +                             break;
> +                     goto error;
> +             }
>               if ((p = memchr((void *)fp->_p, '\n', fp->_r)) == NULL)
>                       continue;
>  
> 

Reply via email to