Ticket #3412: mc-3412-filemanager-rely-on-realpath-for-device-info.patch

File mc-3412-filemanager-rely-on-realpath-for-device-info.patch, 1.6 KB (added by and, 9 years ago)
  • src/filemanager/info.c

    From b1bc205fe64d9b921ef4c3cccf0065d7e9909073 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sat, 9 Jan 2016 11:07:45 +0000
    Subject: [PATCH] panelinfo: rely on realpath for device info
    
    when cd_symlinks enabled cwd_vpath don't pointed to real path
    hence device info may wrong
    
    (support for local filesystems only)
    
    Thanks Alain and Denis for reporting
    
    fix it and resolve #3412
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/filemanager/info.c | 10 +++++++++-
     1 file changed, 9 insertions(+), 1 deletion(-)
    
    diff --git a/src/filemanager/info.c b/src/filemanager/info.c
    index 0824dbc..6587ca8 100644
    a b  
    3131#include <config.h> 
    3232 
    3333#include <stdio.h> 
     34#include <stdlib.h>             /* realpath */ 
    3435#include <sys/stat.h> 
    3536#include <inttypes.h>           /* PRIuMAX */ 
    3637 
    info_show_info (WInfo * info) 
    108109    static const char *file_label; 
    109110    GString *buff; 
    110111    struct stat st; 
     112    char rp_cwd[PATH_MAX]; 
     113    const char *p_rp_cwd; 
    111114 
    112115    if (!is_idle ()) 
    113116        return; 
    info_show_info (WInfo * info) 
    124127    if (get_current_type () != view_listing) 
    125128        return; 
    126129 
    127     my_statfs (&myfs_stats, vfs_path_as_str (current_panel->cwd_vpath)); 
     130    /* don't rely on vpath CWD when cd_symlinks enabled */ 
     131    p_rp_cwd = mc_realpath (vfs_path_as_str (current_panel->cwd_vpath), rp_cwd); 
     132    if (p_rp_cwd == NULL) 
     133        p_rp_cwd = vfs_path_as_str (current_panel->cwd_vpath); 
     134 
     135    my_statfs (&myfs_stats, p_rp_cwd); 
    128136 
    129137    st = current_panel->dir.list[current_panel->selected].st; 
    130138