From b7f2b51c42edabd516c5ecc748a654da736c912c Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 1 Jan 2010 07:39:29 -0700 Subject: ls: fix color of broken symlinks colored as target * src/ls.c (print_color_indicator): When using 'LINK target' in dircolors, treat broken symlink as C_ORPHAN. * tests/misc/ls-misc (sl-dangle2, sl-dangle3, sl-dangle4) (sl-dangle5): Test for it, and add more coverage. * NEWS: Document it. * THANKS: Update. Reported by Chris Jones. --- src/ls.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/ls.c') diff --git a/src/ls.c b/src/ls.c index 04fa93cae..aa601fdc2 100644 --- a/src/ls.c +++ b/src/ls.c @@ -4164,7 +4164,9 @@ print_color_indicator (const struct fileinfo *f, bool symlink_target) type = C_STICKY; } else if (S_ISLNK (mode)) - type = ((!linkok && color_indicator[C_ORPHAN].string) + type = ((!linkok + && (!strncmp (color_indicator[C_LINK].string, "target", 6) + || color_indicator[C_ORPHAN].string)) ? C_ORPHAN : C_LINK); else if (S_ISFIFO (mode)) type = C_FIFO; -- cgit v1.2.3-54-g00ecf