Ticket #3214: mc-3214-avoid-invalid-free-nodes-display.patch

File mc-3214-avoid-invalid-free-nodes-display.patch, 1.4 KB (added by and, 4 years ago)
  • src/filemanager/info.c

    From c7a25f0c0ea77ec865bc405a2df2f8b4953f7ea6 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sun, 3 Jan 2016 22:39:52 +0000
    Subject: [PATCH] avoid invalid free nodes display
    
    ticket #3214 illustrate that nfree & nodes can be (uintmax_t) -1
    don't print such numbers at info panel
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/filemanager/info.c | 9 ++++++++-
     1 file changed, 8 insertions(+), 1 deletion(-)
    
    diff --git a/src/filemanager/info.c b/src/filemanager/info.c
    index 0824dbc..b6a5fef 100644
    a b info_show_info (WInfo * info) 
    149149 
    150150    case 16: 
    151151        widget_move (w, 16, 3); 
    152         if (myfs_stats.nfree == 0 && myfs_stats.nodes == 0) 
     152        if ((myfs_stats.nfree == 0 && myfs_stats.nodes == 0) || 
     153            (myfs_stats.nfree == (uintmax_t) -1 && myfs_stats.nodes == (uintmax_t) -1)) 
    153154            tty_print_string (_("No node information")); 
     155        else if (myfs_stats.nfree == (uintmax_t) -1) 
     156            tty_printf ("%s -/%" PRIuMAX, 
     157                        _("Free nodes:"),myfs_stats.nodes); 
     158        else if (myfs_stats.nodes == (uintmax_t) -1) 
     159            tty_printf ("%s %" PRIuMAX "/-", 
     160                        _("Free nodes:"),myfs_stats.nfree); 
    154161        else 
    155162            tty_printf ("%s %" PRIuMAX "/%" PRIuMAX " (%d%%)", 
    156163                        _("Free nodes:"),