Ticket #2478: HARDLINK file type

It doesn't work as documented, but instead seems to *wrongly* identify/highlight symlinks instead.
Of course, the LINK type also fails to detect hardlinks.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Curtis Doty 2011-02-04 13:40:50 +02:00 committed by Slava Zanko
parent 92061acce5
commit 264f90b675
1 changed files with 8 additions and 4 deletions

View File

@ -80,6 +80,12 @@ mc_fhl_is_link (file_entry * fe)
return S_ISLNK (fe->st.st_mode);
}
inline static gboolean
mc_fhl_is_hlink (file_entry * fe)
{
return (fe->st.st_nlink > 1);
}
inline static gboolean
mc_fhl_is_link_to_dir (file_entry * fe)
{
@ -175,16 +181,14 @@ mc_fhl_get_color_filetype (mc_fhl_filter_t * mc_filter, mc_fhl_t * fhl, file_ent
my_color = TRUE;
break;
case MC_FLHGH_FTYPE_T_LINK:
if (mc_fhl_is_link (fe))
if ((mc_fhl_is_link (fe)) || (mc_fhl_is_hlink (fe)))
my_color = TRUE;
break;
case MC_FLHGH_FTYPE_T_HARDLINK:
/*TODO: hanlde it */
if (mc_fhl_is_link (fe))
if (mc_fhl_is_hlink (fe))
my_color = TRUE;
break;
case MC_FLHGH_FTYPE_T_SYMLINK:
/*TODO: hanlde it */
if (mc_fhl_is_link (fe))
my_color = TRUE;
break;