[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] canonicalize: add support for not resolving symlinks
From: |
Eric Blake |
Subject: |
Re: [PATCH] canonicalize: add support for not resolving symlinks |
Date: |
Fri, 30 Dec 2011 06:49:16 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 |
On 12/30/2011 04:04 AM, Jim Meyering wrote:
>> - if (lstat (rname, &st) != 0)
>> + if ((logical?stat:lstat) (rname, &st) != 0)
>
> Please add spaces around operators:
>
> if ((logical ? stat : lstat) (rname, &st) != 0)
Better yet, don't write this as a function pointer conditional, as the
gnulib replacement for stat on some platforms has to be a function-like
macro (no thanks to 'struct stat'). Using a function pointer
conditional risks missing the gnulib macro for stat, and calling the
underlying system stat() instead of the intended rpl_stat(), for broken
behavior. You have to use:
if (logical ? stat (rname, &st) : lstat (rname, &st)) != 0)
--
Eric Blake address@hidden +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [PATCH] canonicalize: add support for not resolving symlinks, Pádraig Brady, 2011/12/29
- Re: [PATCH] canonicalize: add support for not resolving symlinks, Paul Eggert, 2011/12/30
- Re: [PATCH] canonicalize: add support for not resolving symlinks, Eric Blake, 2011/12/30
- Re: [PATCH] canonicalize: add support for not resolving symlinks, Paul Eggert, 2011/12/30
- Re: [PATCH] canonicalize: add support for not resolving symlinks, Eric Blake, 2011/12/31