Ticket #3278: infopanel-follow-symlinks.patch

File infopanel-follow-symlinks.patch, 1.6 KB (added by mcermak, 10 years ago)
  • src/filemanager/mountlist.c

    diff -Naur mc-4.8.13.old/src/filemanager/mountlist.c mc-4.8.13.new/src/filemanager/mountlist.c
    old new  
    15981600my_statfs (struct my_statfs *myfs_stats, const char *path) 
    15991601{ 
    16001602#ifdef HAVE_INFOMOUNT_LIST 
     1603    const char *rpath; 
    16011604    size_t len = 0; 
    16021605    struct mount_entry *entry = NULL; 
    16031606    struct mount_entry *temp = mc_mount_list; 
    16041607    struct fs_usage fs_use; 
    16051608 
     1609    if ((rpath = realpath(path, NULL)) == NULL) 
     1610        rpath = path; 
     1611 
    16061612    while (temp) 
    16071613    { 
    16081614        size_t i; 
    16091615 
    16101616        i = strlen (temp->me_mountdir); 
    1611         if (i > len && (strncmp (path, temp->me_mountdir, i) == 0)) 
    1612             if (!entry || (path[i] == PATH_SEP || path[i] == '\0')) 
     1617        if (i > len && (strncmp (rpath, temp->me_mountdir, i) == 0)) 
     1618            if (!entry || (rpath[i] == PATH_SEP || rpath[i] == '\0')) 
    16131619            { 
    16141620                len = i; 
    16151621                entry = temp; 
     
    16201626    if (entry) 
    16211627    { 
    16221628        memset (&fs_use, 0, sizeof (struct fs_usage)); 
    1623         get_fs_usage (entry->me_mountdir, NULL, &fs_use); 
     1629        get_fs_usage (rpath, NULL, &fs_use); 
    16241630 
    16251631        myfs_stats->type = entry->me_dev; 
    16261632        myfs_stats->typename = entry->me_type; 
     
    16721678        myfs_stats->nfree = 0; 
    16731679        myfs_stats->nodes = 0; 
    16741680    } 
     1681 
     1682#ifdef HAVE_INFOMOUNT_LIST 
     1683    if (rpath != path) 
     1684        free((void *) rpath); 
     1685#endif /* HAVE_INFOMOUNT_LIST */ 
    16751686} 
    16761687 
    16771688/* --------------------------------------------------------------------------------------------- */