From: Jim Meyering Date: Thu, 19 Dec 1996 05:15:34 +0000 (+0000) Subject: (gobble_file): Stat symlinks also when printing with X-Git-Tag: FILEUTILS-3_14a~72 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c835f92a6185871565c607227a8131a24b985a6e;p=thirdparty%2Fcoreutils.git (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. --- diff --git a/src/ls.c b/src/ls.c index 182175eee7..b924592dc2 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. */