]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(gobble_file): Set linkok for non-orphaned symlinks.
authorJim Meyering <jim@meyering.net>
Sat, 2 Nov 1996 15:28:08 +0000 (15:28 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 2 Nov 1996 15:28:08 +0000 (15:28 +0000)
From Bauke Jan Douma.
(gobble_file): Initialize linkok.
With these two changes, ls --color should display orphaned symlinks
as blinking text on terminals that support it.

src/ls.c

index f112e7a33ae61b6cd1a6d058895b660499df5461..bce89268bd556968d43692de9eb984f2eaf6fa92 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -112,7 +112,7 @@ struct fileinfo
     unsigned int linkmode;
 
     /* For symbolic link and color printing, 1 if linked-to file
-       exits, otherwise 0.  */
+       exists, otherwise 0.  */
     int linkok;
 
     enum filetype filetype;
@@ -1594,6 +1594,7 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
 
   files[files_index].linkname = 0;
   files[files_index].linkmode = 0;
+  files[files_index].linkok = 0;
 
   if (explicit_arg || format_needs_stat)
     {
@@ -1659,9 +1660,12 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
                  files[files_index].stat = linkstats;
                }
              else
-               /* Get the linked-to file's mode for the filetype indicator
-                  in long listings.  */
-               files[files_index].linkmode = linkstats.st_mode;
+               {
+                 /* Get the linked-to file's mode for the filetype indicator
+                    in long listings.  */
+                 files[files_index].linkmode = linkstats.st_mode;
+                 files[files_index].linkok = 1;
+               }
            }
          if (linkpath)
            free (linkpath);