svn commit: r295631 - head/lib/libc/stdio

Conrad Meyer cem at FreeBSD.org
Mon Feb 15 22:19:25 UTC 2016


On Mon, Feb 15, 2016 at 10:13 AM, Pedro F. Giffuni <pfg at freebsd.org> wrote:
> Author: pfg
> Date: Mon Feb 15 18:13:33 2016
> New Revision: 295631
> URL: https://svnweb.freebsd.org/changeset/base/295631
> ...
>   Note that this implementation convention cannot be adhered to for strings
>   longer than {INT_MAX} bytes as the value would not be representable in the
>   return type of the function. For backwards-compatibility, implementations
>   can return the number of bytes for strings of up to {INT_MAX} bytes, and
>   return {INT_MAX} for all longer strings.
> ...
> --- head/lib/libc/stdio/fputs.c Mon Feb 15 17:14:10 2016        (r295630)
> +++ head/lib/libc/stdio/fputs.c Mon Feb 15 18:13:33 2016        (r295631)
> ...
> @@ -62,5 +63,7 @@ fputs(const char * __restrict s, FILE *
>         ORIENT(fp, -1);
>         retval = __sfvwrite(fp, &uio);
>         FUNLOCKFILE(fp);
> +       if (retval == 0)
> +               return (iov.iov_len > INT_MAX ? INT_MAX : uio.uio_resid);

                 ^^^^^^^^^^^ why not uio.uio_resid here as well?

>         return (retval);
>  }


Best,
Conrad


More information about the svn-src-all mailing list