[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ls: allow stat-free use of --color
From: |
Jim Meyering |
Subject: |
Re: [PATCH] ls: allow stat-free use of --color |
Date: |
Wed, 11 May 2011 19:26:49 +0200 |
Pádraig Brady wrote:
> On 11/05/11 16:52, Jim Meyering wrote:
>> diff --git a/src/ls.c b/src/ls.c
>> index 4262923..54876ce 100644
>> --- a/src/ls.c
>> +++ b/src/ls.c
>> @@ -2740,7 +2740,10 @@ gobble_file (char const *name, enum filetype type,
>> ino_t inode,
>> /* When coloring a directory (we may know the type from
>> direct.d_type), we have to stat it in order to indicate
>> sticky and/or other-writable attributes. */
>> - || (type == directory && print_with_color)
>> + || (type == directory && print_with_color
>> + && (is_colored (C_OTHER_WRITABLE)
>> + || is_colored (C_STICKY)
>> + || is_colored (C_STICKY_OTHER_WRITABLE)))
>> /* When dereferencing symlinks, the inode and type must come from
>> stat, but readdir provides the inode and type of lstat. */
>> || ((print_inode || format_needs_type)
>
> Looks good.
Thanks for the review.