summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-12-19 05:15:34 +0000
committerJim Meyering <jim@meyering.net>1996-12-19 05:15:34 +0000
commitc835f92a6185871565c607227a8131a24b985a6e (patch)
tree45147c2913e4a90eaf07b6826f153c48f9c3bf28 /src
parent89b765e32c6f9e35c10db8015b96d32b68f5740a (diff)
downloadcoreutils-c835f92a6185871565c607227a8131a24b985a6e.tar.xz
(gobble_file): Stat symlinks also when printing with
color and set linkok to reflect existence of referent. Patches from Joakim Rosqvist, James Antill, and Jesse Thilo.
Diffstat (limited to 'src')
-rw-r--r--src/ls.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ls.c b/src/ls.c
index 182175eee..b924592dc 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -1630,7 +1630,7 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
#ifdef S_ISLNK
if (S_ISLNK (files[files_index].stat.st_mode)
- && (explicit_arg || format == long_format))
+ && (explicit_arg || format == long_format || print_with_color))
{
char *linkpath;
struct stat linkstats;
@@ -1642,9 +1642,12 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
they won't be traced and when no indicator is needed. */
if (linkpath
&& ((explicit_arg && format != long_format)
- || indicator_style != none)
+ || indicator_style != none
+ || print_with_color)
&& stat (linkpath, &linkstats) == 0)
{
+ files[files_index].linkok = 1;
+
/* Symbolic links to directories that are mentioned on the
command line are automatically traced if not being
listed as files. */