Upstream bugID: #3278
Synopsis: Info panel should follow symlinks
Bug record: https://www.midnight-commander.org/ticket/3278
--- mc-4.8.16.orig/src/filemanager/mountlist.c 2016-03-12 16:45:48.000000000 +0100
+++ mc-4.8.16/src/filemanager/mountlist.c 2016-03-14 16:24:08.833958362 +0100
@@ -1701,11 +1701,15 @@
my_statfs (struct my_statfs *myfs_stats, const char *path)
{
#ifdef HAVE_INFOMOUNT_LIST
+ const char *rpath;
size_t len = 0;
struct mount_entry *entry = NULL;
GSList *temp;
struct fs_usage fs_use;
+ if ((rpath = realpath(path, NULL)) == NULL)
+ rpath = path;
+
for (temp = mc_mount_list; temp != NULL; temp = g_slist_next (temp))
{
struct mount_entry *me;
@@ -1713,8 +1717,8 @@
me = (struct mount_entry *) temp->data;
i = strlen (me->me_mountdir);
- if (i > len && (strncmp (path, me->me_mountdir, i) == 0) &&
- (entry == NULL || IS_PATH_SEP (path[i]) || path[i] == '\0'))
+ if (i > len && (strncmp (rpath, me->me_mountdir, i) == 0) &&
+ (entry == NULL || IS_PATH_SEP (rpath[i]) || rpath[i] == '\0'))
{
len = i;
entry = me;
@@ -1724,7 +1728,7 @@
if (entry != NULL)
{
memset (&fs_use, 0, sizeof (fs_use));
- get_fs_usage (entry->me_mountdir, NULL, &fs_use);
+ get_fs_usage (rpath, NULL, &fs_use);
myfs_stats->type = entry->me_dev;
myfs_stats->typename = entry->me_type;
@@ -1778,6 +1782,11 @@
myfs_stats->nfree = 0;
myfs_stats->nodes = 0;
}
+
+#ifdef HAVE_INFOMOUNT_LIST
+ if (rpath != path)
+ free((void *) rpath);
+#endif /* HAVE_INFOMOUNT_LIST */
}
/* --------------------------------------------------------------------------------------------- */