summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-08-26 06:46:17 +0000
committerJim Meyering <jim@meyering.net>2006-08-26 06:46:17 +0000
commit967e0c11eaecf01a8596b8b48e8ef8edc85318fd (patch)
treea2a82cd27535db0155b670dda7c96133d0d2fe6e /src
parent0d41cd8f2927d896f373fb6076c2508c9284a978 (diff)
downloadcoreutils-967e0c11eaecf01a8596b8b48e8ef8edc85318fd.tar.xz
"ls --color" would highlight other-writable and sticky directories
no differently than regular directories on a file system with dirent.d_type support. * NEWS: Say the above. * src/ls.c (gobble_file): With --color, also stat the file when we know it is a directory. Derived from an anonymous one-line fix and bug report: <https://savannah.gnu.org/bugs/?15043>. * tests/ls/color-dtype-dir: New file. Test for the above fix. * tests/ls/Makefile.am (TESTS): Add color-dtype-dir.
Diffstat (limited to 'src')
-rw-r--r--src/ls.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ls.c b/src/ls.c
index 162b5157c..8b4fb2e43 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -2531,6 +2531,10 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
if (command_line_arg
|| format_needs_stat
+ /* 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)
|| (print_inode
&& (inode == NOT_AN_INODE_NUMBER
/* When dereferencing symlinks, the inode must come from