Ticket #3277 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Info panel can't obtain file system statistics

Reported by: mcermak Owned by:
Priority: minor Milestone: 4.8.14
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset: committed-master

Description

On Solaris, when an info-panel is displayed, the file system information is not shown. No statistics is shown at all, as if the application can't perform statvfs() call.

# mc -V
GNU Midnight Commander 4.8.13
Built with GLib 2.28.6
Using the S-Lang library with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm
With support for X11 events
With internationalization support
With multiple codepages support
Virtual File Systems: cpiofs, tarfs, sfs, extfs, ftpfs, fish
Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;

This is due to uninitialized variable lockfd in filemanager/mountlist.c read_file_system_list() function (line 1002). lockfd is intialized in conditionally compiled code (line 1012) but used unconditionally (line 1059). This causes an error and the file system list read from /etc/mnttab is thrown away.

Attachments

infopanel-cant-statvfs.patch (917 bytes) - added by mcermak 2 years ago.
Patch for 4.8.13

Change History

Changed 2 years ago by mcermak

Patch for 4.8.13

comment:1 Changed 2 years ago by andrew_b

Is the following trivial patch enough?

--- a/src/filemanager/mountlist.c
+++ b/src/filemanager/mountlist.c
@@ -999,7 +999,7 @@ read_file_system_list (int need_fs_type)
         char *table = MNTTAB;
         FILE *fp;
         int ret;
-        int lockfd;
+        int lockfd = -1;
 
 #if defined F_RDLCK && defined F_SETLKW
         /* MNTTAB_LOCK is a macro name of our own invention; it's not present in

comment:2 follow-up: ↓ 3 Changed 2 years ago by mcermak

Yes, that'll do. But the variable lockfd is useless when F_RDLCK or F_SETLKW is not defined.

comment:3 in reply to: ↑ 2 Changed 2 years ago by andrew_b

Actually, most part of mc's mountlist is the mix of gnulib's mountlist and fsusage modules.

Replying to mcermak:

Yes, that'll do. But the variable lockfd is useless when F_RDLCK or F_SETLKW is not defined.

I try keep as much as possible the code taken from gnulib because I sync the mc code with gnulib one.
If you want you can send your patch to gnulib mailing list.

comment:4 Changed 2 years ago by andrew_b

  • Blocked By 3265 added

comment:5 Changed 2 years ago by andrew_b

  • Status changed from new to closed
  • Votes for changeset set to committed-master
  • Resolution set to fixed
  • Blocked By 3265 removed
Note: See TracTickets for help on using tickets.