From c835f92a6185871565c607227a8131a24b985a6e Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 19 Dec 1996 05:15:34 +0000 Subject: [PATCH] (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. --- src/ls.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ls.c b/src/ls.c index 182175e..b924592 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. */ -- 2.7.4