bug-coreutils
[Top][All Lists]
Advanced

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

bug#15173: [PATCH] cp: with --link always use linkat() if available


From: Pádraig Brady
Subject: bug#15173: [PATCH] cp: with --link always use linkat() if available
Date: Mon, 10 Feb 2014 04:02:22 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 02/10/2014 02:29 AM, Paul Eggert wrote:
> Pádraig Brady wrote:
>> +#if ! defined HAVE_LINKAT
>>              && !(LINK_FOLLOWS_SYMLINKS && S_ISLNK (src_mode)
>> -                && x->dereference == DEREF_NEVER))
>> +                && x->dereference == DEREF_NEVER)
>> +#endif
> 
> Could you reword that sort of thing so as not to use the #if inside an 
> expression?  Something like this instead, perhaps, earlier in the code:
> 
>   #if !defined HAVE_LINKAT && LINK_FOLLOWS_SYMLINKS
>   # define LINKAT_FOLLOWS_SYMLINKS 1
>   #else
>   # define LINKAT_FOLLOWS_SYMLINKS 0
>   #endif

That's slightly confusing as linkat() emulation never
actually symlinks the referent.  I went for the more direct:

 #if defined HAVE_LINKAT || ! LINK_FOLLOWS_SYMLINKS
 # define CAN_HARDLINK_SYMLINKS 1
 #else
 # define CAN_HARDLINK_SYMLINKS 0
 #endif

Full patch is attached.

thanks,
Pádraig.

Attachment: cp-linkat.patch
Description: Text Data


reply via email to

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