]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(gobble_file): Stat symlinks also when printing with
authorJim Meyering <jim@meyering.net>
Thu, 19 Dec 1996 05:15:34 +0000 (05:15 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 19 Dec 1996 05:15:34 +0000 (05:15 +0000)
color and set linkok to reflect existence of referent.
Patches from Joakim Rosqvist, James Antill, and Jesse Thilo.

src/ls.c

index 182175eee70908626220f581d9020478769bbf14..b924592dc26047aca9f29ec2178887b370230df3 100644 (file)
--- 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.  */