summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2015-06-08 19:13:04 +0000
committerdelphij <delphij@FreeBSD.org>2015-06-08 19:13:04 +0000
commit02d6f9793e77d31210bea137c2f400f4acb5ee8c (patch)
treec2fb07a1f9068a3b02c8a22c75e7040ea037328f /bin
parent9de4cb45dbf7d228eb57b13727f12422705f0521 (diff)
downloadFreeBSD-src-02d6f9793e77d31210bea137c2f400f4acb5ee8c.zip
FreeBSD-src-02d6f9793e77d31210bea137c2f400f4acb5ee8c.tar.gz
It has been long time that when doing 'ls -G /path/to/a/symlink', instead of
using the color of symbolic link, the color is determined by the link target. This behavior was quite confusing. Looking at the file history, it looks like that r203665 intends to fix this but the issue was never actually fixed. Fix this by not setting FTS_COMFOLLOW when color is requested like what was done in r203665. MFC after: 2 weeks
Diffstat (limited to 'bin')
-rw-r--r--bin/ls/ls.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index a46f358..74276c1 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -413,9 +413,14 @@ main(int argc, char *argv[])
/*
* If not -F, -P, -d or -l options, follow any symbolic links listed on
- * the command line.
+ * the command line, unless in color mode in which case we need to
+ * distinguish file type for a symbolic link itself and its target.
*/
- if (!f_nofollow && !f_longform && !f_listdir && (!f_type || f_slash))
+ if (!f_nofollow && !f_longform && !f_listdir && (!f_type || f_slash)
+#ifdef COLORLS
+ && !f_color
+#endif
+ )
fts_options |= FTS_COMFOLLOW;
/*
OpenPOWER on IntegriCloud