|
1 Upstream bugID: #3278 |
|
2 Synopsis: Info panel should follow symlinks |
|
3 Bug record: https://www.midnight-commander.org/ticket/3278 |
|
4 |
|
5 diff -Naur mc-4.8.13.old/src/filemanager/mountlist.c mc-4.8.13.new/src/filemanager/mountlist.c |
|
6 --- mc-4.8.13.old/src/filemanager/mountlist.c 2014-09-02 11:23:58.000000000 +0200 |
|
7 +++ mc-4.8.13.new/src/filemanager/mountlist.c 2014-09-26 17:07:08.135044849 +0200 |
|
8 @@ -1598,18 +1600,22 @@ |
|
9 my_statfs (struct my_statfs *myfs_stats, const char *path) |
|
10 { |
|
11 #ifdef HAVE_INFOMOUNT_LIST |
|
12 + const char *rpath; |
|
13 size_t len = 0; |
|
14 struct mount_entry *entry = NULL; |
|
15 struct mount_entry *temp = mc_mount_list; |
|
16 struct fs_usage fs_use; |
|
17 |
|
18 + if ((rpath = realpath(path, NULL)) == NULL) |
|
19 + rpath = path; |
|
20 + |
|
21 while (temp) |
|
22 { |
|
23 size_t i; |
|
24 |
|
25 i = strlen (temp->me_mountdir); |
|
26 - if (i > len && (strncmp (path, temp->me_mountdir, i) == 0)) |
|
27 - if (!entry || (path[i] == PATH_SEP || path[i] == '\0')) |
|
28 + if (i > len && (strncmp (rpath, temp->me_mountdir, i) == 0)) |
|
29 + if (!entry || (rpath[i] == PATH_SEP || rpath[i] == '\0')) |
|
30 { |
|
31 len = i; |
|
32 entry = temp; |
|
33 @@ -1620,7 +1626,7 @@ |
|
34 if (entry) |
|
35 { |
|
36 memset (&fs_use, 0, sizeof (struct fs_usage)); |
|
37 - get_fs_usage (entry->me_mountdir, NULL, &fs_use); |
|
38 + get_fs_usage (rpath, NULL, &fs_use); |
|
39 |
|
40 myfs_stats->type = entry->me_dev; |
|
41 myfs_stats->typename = entry->me_type; |
|
42 @@ -1672,6 +1678,11 @@ |
|
43 myfs_stats->nfree = 0; |
|
44 myfs_stats->nodes = 0; |
|
45 } |
|
46 + |
|
47 +#ifdef HAVE_INFOMOUNT_LIST |
|
48 + if (rpath != path) |
|
49 + free((void *) rpath); |
|
50 +#endif /* HAVE_INFOMOUNT_LIST */ |
|
51 } |
|
52 |
|
53 /* --------------------------------------------------------------------------------------------- */ |