summaryrefslogtreecommitdiff
path: root/src/ls.c
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2010-01-01 07:39:29 -0700
committerEric Blake <ebb9@byu.net>2010-01-01 13:41:46 -0700
commitb7f2b51c42edabd516c5ecc748a654da736c912c (patch)
tree75db10733b43f2bb3c46abc58b3384e77191f8af /src/ls.c
parent84db964925680c912c601f616d4ab07f7bc19c3c (diff)
downloadcoreutils-b7f2b51c42edabd516c5ecc748a654da736c912c.tar.xz
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.
Diffstat (limited to 'src/ls.c')
-rw-r--r--src/ls.c4
1 files changed, 3 insertions, 1 deletions
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;