bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/4] stdio: use __REDIRECT for fwrite, fwrite_unlocked


From: Eric Blake
Subject: Re: [PATCH 1/4] stdio: use __REDIRECT for fwrite, fwrite_unlocked
Date: Wed, 15 May 2013 22:18:51 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5

On 05/15/2013 09:52 PM, Paul Eggert wrote:
> ---
>  ChangeLog      | 10 ++++++++++
>  lib/stdio.in.h | 19 +++++++++++++------
>  2 files changed, 23 insertions(+), 6 deletions(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index dfb2e5c..3544972 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,5 +1,15 @@
>  2013-05-15  Paul Eggert  <address@hidden>
>  
> +     stdio: use __REDIRECT for fwrite, fwrite_unlocked

My first worry is that __REDIRECT is non-standard; but then I realized:

>  #  if (0 < __USE_FORTIFY_LEVEL                                          \
>         && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \

We only get here on glibc, where system headers give us __REDIRECT, so

> +#   undef fwrite
> +#   undef fwrite_unlocked
> +extern size_t __REDIRECT (rpl_fwrite,
> +                          (const void *__restrict, size_t, size_t,
> +                           FILE *__restrict),
> +                          fwrite);

this usage only has to work for glibc, which it does.  Interesting solution.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]