Upstream bugID: #3278
Synopsis: Info panel should follow symlinks
Bug record: https://www.midnight-commander.org/ticket/3278
diff -Naur mc-4.8.13.old/src/filemanager/mountlist.c mc-4.8.13.new/src/filemanager/mountlist.c
--- mc-4.8.13.old/src/filemanager/mountlist.c 2014-09-02 11:23:58.000000000 +0200
+++ mc-4.8.13.new/src/filemanager/mountlist.c 2014-09-26 17:07:08.135044849 +0200
@@ -1598,18 +1600,22 @@
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;
struct mount_entry *temp = mc_mount_list;
struct fs_usage fs_use;
+ if ((rpath = realpath(path, NULL)) == NULL)
+ rpath = path;
+
while (temp)
{
size_t i;
i = strlen (temp->me_mountdir);
- if (i > len && (strncmp (path, temp->me_mountdir, i) == 0))
- if (!entry || (path[i] == PATH_SEP || path[i] == '\0'))
+ if (i > len && (strncmp (rpath, temp->me_mountdir, i) == 0))
+ if (!entry || (rpath[i] == PATH_SEP || rpath[i] == '\0'))
{
len = i;
entry = temp;
@@ -1620,7 +1626,7 @@
if (entry)
{
memset (&fs_use, 0, sizeof (struct fs_usage));
- 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;
@@ -1672,6 +1678,11 @@
myfs_stats->nfree = 0;
myfs_stats->nodes = 0;
}
+
+#ifdef HAVE_INFOMOUNT_LIST
+ if (rpath != path)
+ free((void *) rpath);
+#endif /* HAVE_INFOMOUNT_LIST */
}
/* --------------------------------------------------------------------------------------------- */