Commit Graph

6403 Commits

Author SHA1 Message Date
Andrew Borodin
328d27ccf1 Ticket #4426: code clean up before 4.8.30 release.
(sftpfs_cb_open): minor optimization.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin
e254656c48 Ticket #4434: mc.ext.ini: 'Edit' command from 'Default' section is ingored.
(regex_command_for): execute the required action from the 'Default'
section if this action is not specified in the found section.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-23 20:27:01 +03:00
Andrew Borodin
b2ffac752f Ticket #4427: extfs: "Inconsistent archive" error for valid RPM.
(extfs_read_archive): fix condition to display message "Inconsistent archive".

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-15 10:47:19 +03:00
Andrew Borodin
9962abd701 (extfs_read_archive): show error message.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-07 09:27:54 +03:00
Jindrich Novy
69ed5696f2 Ticket #4422: extfs: segfault if archive contains file(s) in the parent directory.
zip archive can contain files outside archive root:

$ unzip -l tmp.zip
Archive:  tmp.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2023-01-04 19:43   a
        0  2023-01-04 19:43   b
        0  2023-01-04 19:43   ../c
        0  2023-01-04 19:43   ../../d
---------                     -------
        0                     4 files

Enter into such archive leads to a segfault.

(extfs_find_entry_int): fix possible NULL dereference. The result of this
fix is an impossibility to enter into such archive.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-07 09:27:24 +03:00
Andrew Borodin
3f882f50e0 Ticket #4413: mcedit: syntax definitions in user location don't work.
Fix location of all user's syntax related stuff. Now it is the
~/.local/share/mc/syntax/ directory.

Don't use the system configuration directory (/etc/mc) as a storage
of syntax definitions.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-12-18 14:20:36 +03:00
Andrew Borodin
1ac5c22517 Ticket #3121: empty subshell/command line prompt.
If subshell is initializing more than 1 second - we have no subshell.

(feed_subshell): change timeout to 10 secons. I belive that is more than
enough time to run subshell.

Thanks Alexandr Zamaraev (aka Tonal) <tonal.promsoft@gmail.com> and
antonio_so <sozonnik@gmail.com> for finding out the cause of the
problem.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-11-26 14:21:55 +03:00
Andrew Borodin
a72ede698e Ticket #3220: fix directory comparision in panelized panel.
Directory comparision expects only file names in both panels.
In panelized panel, files named can contain paths:

| boxes.c   | 43220|| 1/boxes.c   | 43220|
| boxes.h   | 1429 || 1/boxes.h   |  1429|
|           |      || boxes.c     | 43220|
|           |      || boxes.h     |  1429|

Even if boxes.c and 1/boxes.c files are the same, they are marked as
different because strings "boxes.c" and "1/boxes.c" are different.

The solution: for panelized panel, ignore path and use file name only
(like output of basename(3)) for comparision.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-11-14 20:59:05 +03:00
Andrew Borodin
30f9309b8a Ticket 4409: continue copy after interrupt.
(copy_file_file): add button "Continue copy" to query dialog "Incomplete
file was retrieved".
(file_ui_op_dlg_callback): callback for copy/move progess dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-15 21:14:35 +03:00
Andrew Borodin
47b116b773 mc_search: refactoring.
(mc_search_t): use GString to keep original search string. Join search string
and charset to structure.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin
f778c86e4d Revert "(extfs_open_archive): fix NULL dereferences."
This reverts commit 0df10f488b.

g_strconcat() accepts NULL after non-NULL arguments.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin
116b6a616a (fish_dir_load): move ls -l output parser to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Ovsyannikov Sergey E
3e7424a95a FTP fixes.
* (parse_ls_line): fix get of file GID.
  * (ftpfs_parse_long_list_MLSD): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Ovsyannikov Sergey E
21c45e8a7a Cosmetics: add spaces around slash in statistics messages.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin
bb3ace13f1 Enlarge subshell PTY buffer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin
a7833b5b2e (real_warn_same_file): truncate file names if required.
If file name is too long, message window is wider than screen.
Truncate file name to fit it in the screen.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin
facf199f65 (fish_free_archive): check socket before close.
Find by Coverity.
Coverity id #313668.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin
c441250beb mcviewer: move.c: fix coding style. 2022-10-10 21:07:40 +03:00
Andrew Borodin
fba3d47408 mcviewer: internal.h: fix coding style. 2022-10-10 21:07:40 +03:00
Andrew Borodin
72f5211327 (check_dir_is_empty): clarify description.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-09 14:02:19 +03:00
Andrew Borodin
d4d6cec52d Ticket #4364: FISH VFS: cannot remove non-empty directory.
Revert "(check_dir_is_empty): minor optimization."

This reverts commit 25e419ba08.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-02 11:13:17 +03:00
Andrew Borodin
d9eeec9a5a Port mc.ext to INI format.
Ticket #2773: 'include' keyword (for command class def) have no effect
if it was defined before 'Include' keyword (for command def).

Ticket #3742: update comment in mc.ext.ini.

doc: remove mc.ext.ini format description from manual page.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-09-25 14:55:00 +03:00
Andrew Borodin
1cb66b82bd (regex_command_for): move load of extension file to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-28 11:10:39 +03:00
Andrew Borodin
67ec86b570 Ticket #4141: allow compound (AND) conditions in mc.ext
...to disambiguate overloaded extensions

Initial commit:
  * rename macro for mc.ext file: MC_FILEBIND_FILE -> MC_EXT_FILE.
  * (ext_cmd): fix errorous usage of MC_LIB_EXT macro. Use MC_EXT_FILE
    instead.
  * (regex_command_for): likewise. Use already existing variable
    extension_file, remove variable filebind_filename.
  * MC_LIB_EXT: remove macro.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-28 11:10:39 +03:00
Michael Schuster
a1f22e104d Ticket #4401: Segmentation fault in mcviewer.
* (mcview_growbuf_read_until): the previous call to mcview_show_error()
   invalidates sp by freeing view->ds_stdio_pipe. Reintroduce the check
   that was removed in a68f2d1202 but take
   sp's invalidity into account.

 * (mc_pclose): add a NULL pointer check to play safe.

Signed-off-by: Michael Schuster <michael@schuster.ms>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-20 19:33:12 +03:00
Sergei Trofimovich
6b67d231a2 Ticket #4399: configure.ac: introduce PERL_FOR_BUILD
Most of mc uses of PERL is to embed path to the interpreter in VFS
helpers. There we can use path to perl for --host. But
`date-of-man-include.am` is the place where perl is used for --build.

On most systems both paths are expected to be /usr/bin/perl.
But on some systems paths might differ a bit. Most prominent
example is NixOS, where packages get installed into unique prefixes:

$ file /nix/store/...-perl-5.36.0/bin/perl \
       /nix/store/...-perl-powerpc64-unknown-linux-gnu-5.36.0/bin/perl
/nix/store/...-perl-5.36.0/bin/perl:
  ELF 64-bit LSB executable, x86-64, version 1 (SYSV), ...
/nix/store/...-perl-powerpc64-unknown-linux-gnu-5.36.0/bin/perl:
  ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, ...

This allows running both binaries via qemu-user if needed for tests.

The change introduces PERL_FOR_BUILD (similar to autoconf's CC_FOR_BUILD
and friends) to allow passing both PERLs when needed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-20 08:26:24 +03:00
Andrew Borodin
ff26ce85f8 Ticket #4398: crash on quick view of archives.
* (extfs_cmd): make message null-terminated.
  * (sfs_vfmake): likewise.
  * (do_external_panelize): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-14 17:57:08 +03:00
Andrew Borodin
36abab7186 Clarify checks of input line content returned from quick dialog.
If quick dialog is finished with value other than B_CANCEL,
string value of input line isn't NULL.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-04 11:19:16 +03:00
Andrew Borodin
79645187c6 (input_get_ctext): mew API.
Use it instead of direct access to WInput's buffer.

(handle_cmdline_enter): additional minor refactoring.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-04 11:17:29 +03:00
Andrew Borodin
318315399b Ticket #4397: sort in editor without arguments stopped working.
* (input_get_text): never return NULL. If buffer is empty, return an
empty allocated string.
  * (input_push_history): use new input_get_text.
  * (find_parameters): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-04 11:09:42 +03:00
sxmboer2
cca4c46d05 (edit_delete_macro): do not resort macros after deleting one
...because g_array_remove_index() keeps the array sorted.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-07-27 19:22:05 +03:00
sxmboer2
01c3c56140 Ticket #4391: fix infinite loop when deleting an mceditor macro.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-07-27 19:22:05 +03:00
Andrew Borodin
6ea06c9845 Ticket #4381: missing selection of some files.
When files are selected keeping the right mouse button pressed,
some files are not selected.

  * Add new macros for mouse pointer location relative to file list.
  * (mark_if_marking): select/unselect all files between previous
    selected file and new one.
  * (panel_mouse_is_on_item): return clarified value of mouse pointer location.
  * (panel_mouse_callback): modify mouse drag event handling in accordance with
    the mouse pointer location relatively to the file list.

Also fixes ticket #4119: "Cannot scroll panel listing upwards using mouse".

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-07-27 19:10:16 +03:00
Andrew Borodin
cd47b158ac Ticket #4373: restore menu accelerator for "Sort order" item.
Menu according for "Sort order" item was changed in
d19b247c6d in order to fix shotrcut
conflict. Restore it back according to user requests.

óhange accelerator for "SFTP link" from S to N.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-07-11 19:44:43 +03:00
Andrew Borodin
debabe561a "file" utility: use -b option if available.
* configure.ac: test if "file" utility has -b option.
  * (regex_check_type): don't compare file names if "file -b" is used.
Reduce variable scope. Rename variable.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-26 20:03:47 +03:00
Andrew Borodin
0bb9c04720 Ticket #4377: file type check does not work with special character in filename.
Initial commit: clarify usage of "file" utility.

  * (get_popen_information): compile conditionally depending on USE_FILE_CMD
macro.
  * (get_file_type_local): likewise.
  * (get_file_encoding_local): likewise.
  * (regex_check_type): likewise.
  * (regex_command_for): ignore type method if file utiliti isn't used.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-26 19:57:37 +03:00
Andrew Borodin
1b93bae611 src/filemanager/dir.c: minor sort optimization.
Get rid of sort condition double check.

Condition

    ad == bd || panels_options.mix_all_files

was checked twice: first in sort_xxx(), then in sort_name() called in
sort_xxx().

Now this condition is checked in sort_xxx() only.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
c7af7f0bbd (edit_sort_cmd): clarify hint for Sort command.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
bae55d637a (ftpfs_setup_active): clarify handling of getnameinfo() errors.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
798f6e87b3 (ftpfs_initconn): clarify errno setup.
Handle errors of bind(), getsockname(), and listen() calls.
Return if one of these functions fails and setup errno to indicate the
cause of the error.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
03cef1bb6f ftpfs.c: variable ftpfs_errno is assigned but never used.
Use me->verrno directly instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
556cf2274d (ftpfs_dir_load): fix building of remote path.
Call of mc_build_filename(remote_path, ".") is pointless
because the path canonicalization is performed and trailing
"/." is removed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
ebb328353e (vfs_s_subclass::dir_load): constify argument.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:44 +03:00
Andrew Borodin
5f746eea0c mceditor: minor refactoring of file load.
(edit_load_file_from_filename): make public, use it as main function to
load file and create editor window.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:56:32 +03:00
Andrew Borodin
12543835f9 (edit_init): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:56:31 +03:00
Andrew Borodin
533b2076dd (edit_add_window): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:06 +03:00
Andrew Borodin
caf41457c6 (widget_adjust_position): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:06 +03:00
Andrew Borodin
390d614b5e (group_init): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:06 +03:00
Andrew Borodin
ccdc909105 (widget_init): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:03 +03:00
Andrew Borodin
2759d080cf Viewer: use WRect to hold position and size of various areas.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:52:14 +03:00
Andrew Borodin
aac258e44e (rect_grow): new API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:50:19 +03:00
Andrew Borodin
5fae2313f3 Widget: use WRect to hold position and size.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:49:20 +03:00
Andrew Borodin
ed65694caa quick_dlg: use WRect to hold dialog position and size.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:37:04 +03:00
Andrew Borodin
bf0dd8efb1 WInput: use GString for buffer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:28:51 +03:00
Andrew Borodin
f91d894f9b (input_get_text): new API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:26:37 +03:00
Andrew Borodin
50f08e2194 (find_parameters): duplicate path when that is really needed.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:23:37 +03:00
Andrew Borodin
88754d040f mcviewer: reimplement coordinate cache using GPtrArray.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:23:37 +03:00
Andrew Borodin
12d976eb6f src/viewer/coord_cache.c: clean up and minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:23:15 +03:00
Andrew Borodin
6f048314b1 (mcview_handle_key): fix variable name.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:22:46 +03:00
Andrew Borodin
03ae9ff24a Ticket #4357: code clean up before 4.8.29 release.
(set_prompt_string): use mc_g_string_dup().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:21:22 +03:00
Andrew Borodin
db109be8a2 Ticket #4374: fix file sort by version.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-05-23 20:56:31 +03:00
Andrew Borodin
81d57da867 Ticket #3670: ftp: reconnect if server terminated connection.
(ftpfs_init_data_socket): handle return value of
getpeername()/getsockname() and try to reconnect to FTP server
for 10 attempts in case of error.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-05-22 11:33:24 +03:00
Eric Roberts
4667618e68 Ticket #4372: fish commands don't work after window resize.
How to reproduce:
  start mc (with fish as your shell);
  resize mc window;
  type any command in the command prompt, for example, "ls";
  result: nothing happens;
  type the same command again;
  it works now, the second time.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-05-14 09:13:59 +03:00
Andrew Borodin
a92b6781b8 Load and save filter parameters.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:45:57 +03:00
Andrew Borodin
a705b67288 Implement more option for panel filter:
"Files only", "Case sensitive", and "Using shell patterns".

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:45:56 +03:00
Andrew Borodin
f20f5cc5cb Rename panel_select_flags_t -> select_flags_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:44:26 +03:00
Andrew Borodin
63e870867e Handle CK_Filter command in the file panel level.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:43:44 +03:00
Andrew Borodin
450993fff6 Add macros for select/unselect histories.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:43:44 +03:00
Andrew Borodin
45073a9d29 (panel_select_unselect_files_dialog): show error message if pattern is malformed.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:43:42 +03:00
Andrew Borodin
733f7ce54b Ticket #1373: add more options to "Filter" dialog window.
The main idea is apply same options for file filter as for file
selection and use the same dialog window.

Initial commit: refactoring: move creation of the file selection dialog
to the separate function.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:42:39 +03:00
Andreas Mohr
1bdf814052 (mc_setup_by_args): reduce variable scope into #ifdef to fix coverity finding.
Found by Coverity.
Coverity id #331837

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin
5b4ec9b033 (translate_file): refactoring.
Allocate buffer only if charset converter is created successfully.
g_string_free() returns NULL if second argument is TRUE. Use that to get
rig of 'if' statement.
Reduce variable scope.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin
a6c142ed48 (get_random_hint): refactoring.
g_string_free() returns NULL if second argument is TRUE. Use that to get
rig of 'if' statement.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin
4518885f93 (dir_list_load): rename argument: fltr -> filter.
(dir_list_reload): likewise.
(handle_dirent): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin
2101026d4c (show_version): display version of libssh2.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin
bb42ed706c (sftpfs_read_known_hosts): clarify displayed value of unknown host key type.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin
f0924b954d (file_mask_dialog): refactoring: get rid of goto.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andreas Mohr
2087ede32d (file_mask_dialog): NULLify variables before use in next iteration.
Found by Coverity.
Coverity id #331828
Coverity id #331850

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin
9f53bf5617 Include <stddef.h> where ptrdiff_t is used.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andrew Borodin
2c205c5928 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andreas Mohr
9489b5edc4 Remove unused macros.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:23 +03:00
Andrew Borodin
ca24b1d136 (ftpfs_check_proxy): read mc.no_proxy file once only.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:23 +03:00
Andrew Borodin
d07abec4c3 (swap_panels): swap panel sort modes too.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:23 +03:00
Andrew Borodin
d8b9589224 Ticket #4326: iso9660: fix isoinfo check.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-01-09 18:17:24 +03:00
Andrew Borodin
529c7d70dd src/editor/editwidget.c: grammar.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
19591c4475 mceditor: use MB_LEN_MAX constant.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
a147082c73 (string_file_name): use mc_g_string_copy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
4e8b00f003 Use g_get_monotonic_time() instead of g_get_real_time().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
31008bcc8e (learn_key): return NULL if buffer is empty.
(learn_button): simplify tests: seq is never empty here.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
a4adc09509 (file_mask_dialog): indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
eefc7c1275 (copy_file_file_display_progress): rename argument to make it clearer.
(copy_file_file): rename variable to make it clearer.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
e8e3204e61 (copy_file_file): don't call g_get_real_time() twice...
in case of successful copying of file content.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
bb1ab8488b (copy_file_file_display_progress): don't calculate BPS twice.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
78df2f5b56 (progress_update_one): don't call g_get_real_time() twice at first time.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
437211791f file operations: use g_get_real_time() instead of gettimeofday().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
d04abc5a76 sftpfs: refactoring.
Merge init.c, vfs_class.c, and vfs_subclass.c to sftpfs.c.
Rename files:
    init.h -> sftpfs.h.
Rename variables:
    sftpfs_class -> vfs_sftpfs_class.
Rename functions:
    sftpfs_cb_is_equal_connection -> sftpfs_archive_same
    sftpfs_cb_init_connection -> sftpfs_new_archive
    sftpfs_cb_open_connection -> sftpfs_open_archive
    sftpfs_cb_close_connection ->  sftpfs_free_archive
to be consistent with other VFSes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
4fce4fa7c3 sftpfs: trivial optimization.
* (sftpfs_opendir): call sftpfs_fix_filename() before loop.
  * (sftpfs_mkdir): likewise.
  * (sftpfs_rmdir): likewise.
  * (sftpfs_open_file): likewise.
  * (sftpfs_stat_init): likewise.
  * (sftpfs_readlink): likewise.
  * (sftpfs_utime): likewise.
  * (sftpfs_chmod): likewise.
  * (sftpfs_unlink): likewise.
  * (sftpfs_rename): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
6623a9014f (panel_operate): update panel content before screen refresh.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:33 +03:00
Andrew Borodin
022c3d2f94 Refactoring of file operations.
(copy_cmd, copy_cmd_local, rename_cmd, rename_cmd_local, delete_cmd,
delete_cmd_local): move same code to panel_operate(), make inline.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:57:43 +03:00
Andrew Borodin
d410af27c0 (start_search): ret rid of extra screen redraw.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:57:43 +03:00
Andrew Borodin
cac689a81a Get rid of extra update of mini info.
(stop_search): don't update mini info if quick search is incative.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:57:43 +03:00
Andrew Borodin
d19b247c6d Ticket #4384: fix accelerator conflict in Left/Right menu.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:57:43 +03:00
Andrew Borodin
a3d323c6b3 Ticket #3887: (handle_console_linux): fix endianness bug.
handle_console_linux() passes the address of action to write() and intends
to send one byte of data (the LSB). On LE this works, but one BE machines
this sends the MSB which is always zero. Fix this by assigning the value
first to a char type, and use that instead.

Thanks Sven Schnelle <svens@stackframe.org> for the original patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:49:46 +03:00
Andrew Borodin
f1e2f0e93d Ticket #4150: support file/dir macros for standalone mcviewer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-10-31 09:49:45 +03:00
Andrew Borodin
8b79bfe32d (free_erase_list): test queue before free.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-10-02 11:41:07 +03:00
Andrew Borodin
89d8fa4ac1 Ticket #1: remove SMB suport.
The mc's built-in samba library which is used to access data across
smb links is taken from an old samba version.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-26 10:03:49 +03:00
Andrew Borodin
c3ba19b422 (sftpfs_chmod): set permissions only, don't touch other attributes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-11 20:34:21 +03:00
Andrew Borodin
8e5f8255e1 Ticket #4285: sftp: timestamps are not preserved for uploaded symlink.
* (sftpfs_symlink): don't call sftpfs_fix_filename() for target file
    bacause it breaks symlink: relative symlinks became an absolute one.
  * (sftpfs_utime): set timestamps only, don't touch other attributes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-11 20:24:30 +03:00
Andrew Borodin
399f25fe9f Ticket #4281: fish upload: symbolic link along with its target.
fish/utime: use `touch -h` to change the times of the link itself
rather than the file that the link points to. -h implies -c
and thus will not create any new files.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-11 09:37:55 +03:00
Andrew Borodin
1b39025049 Ticket #4287: file move across filesystems is slow.
src/filemanager/file.c: reimplement erase_list using GQueue instead of
GSlist to get rid of walk each time through the whole linked list.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-05 11:39:42 +03:00
Andrew Borodin
e7bbf72544 Ticket #4200: fix FTBFS with ncurses build with --disable-widec.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-08-28 11:46:53 +03:00
Sergey Larin
2234fd8357 Ticket #4269: (edit_close_cmd): fix use-after-free.
The old 'w' pointer became invalid after widget_destroy() call, so we need
to get the new widget directly after find_editor.

Found using PVS-Studio 7.14 with intermodular analysis mode.

Signed-off-by: Sergey Larin <cerg2010cerg2010@mail.ru>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-08-09 21:29:23 +03:00
Andrew Borodin
9235d3c232 SFTPFS: verify server fingerprint (fix CVE-2021-36370).
Use ~/.ssh/known_hosts file to verify server fingerprint
using ssh way:

$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ED25519 key fingerprint is SHA256:FzqKTNTroFuNUj1wUzSeV2x/1lpcESnT0ZRCmq5H6o8.
Are you sure you want to continue connecting (yes/no)? no
ssh: Host key verification failed.

$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ED25519 key fingerprint is SHA256:FzqKTNTroFuNUj1wUzSeV2x/1lpcESnT0ZRCmq5H6o8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ED25519) to the list of known hosts.
andrew@localhost's password:

Thanks the Curl project for the used code.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury.zaytsev@moneymeets.com>
2021-07-26 20:34:17 +03:00
Andrew Borodin
fdd6706245 (sftpfs_open_connection): handle EAGAIN for libssh2_session_handshake().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-26 20:34:17 +03:00
Andrew Borodin
b0450a1e18 Ticket #4259: SFTPFS VFS: verify server fingerprint (CVE-2021-36370).
This vulnerability was discovered by AUT-milCERT during an audit of open
source software.

Initial changeset: set minimal version of libssh2 to 1.2.8.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-26 20:33:48 +03:00
m_ok
36e48b04bd Ticket #4260: ftpfs: the month of file is always January.
(parse_ls_line): fix test of vfs_parse_month() value.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-13 21:32:35 +03:00
Eric Roberts
e89713a3d6 Ticket #4198: MC hangs on start randomly with zsh as subshell.
The bug happens because MC tells the shell to perform a "cd" command,
and waits indefinitely for the command to complete. If the shell, for
some reason, cannot complete the "cd" command, MC just freezes
indefinitely.

This patch removes all instances of MC waiting indefinitely for "cd"
commands. Now, if the shell freezes while doing a "cd", MC will timeout
after 1 second, and just set the subshell state to ACTIVE. If the user
tries to run a command, they will get the error "The shell is already
running a command".

Some other stuff where MC waits on the shell if an error occurred is
also simplified.

In feed_subshell(), the timeout time is changed from 10 seconds to
1 second. Ten seconds seemed like far too long to wait.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-04 19:06:28 +03:00
Andrew Borodin
0e6721c32b Ticket #4213: workaround to avoid crash on FreeBSD.
Previous fix 443a8106f1
makes the command line inaccessible if mc runs with
disabled subshell (mc -u).

This commit fixes the command line.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-03 18:59:38 +03:00
Andrew Borodin
7ef1925a98 (render_edit_text): fix endless loop.
Thanks Sebastian Gniazdowski <sgniazdowski@gmail.com> for the issue.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-27 15:02:49 +03:00
Andrew Borodin
eb58d94341 src/filemanager/mountlist.c: recognize fuse.portal as dummy file system.
Sync with gnulib 9a38d499ca16f2f4304992eb1ab0894cd0b478e1.

Add "fuse.portal" as a dummy file system (used in flatpak
implementations).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:46 +03:00
Andrew Borodin
25e419ba08 (check_dir_is_empty): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
437994eb80 (do_move_dir_dir): remove unused variable.
Variable calc_total is set but isn't read.

Found by Andreas Mohr <and@gmx.li>.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
106d95229f (sftpfs_open_file): don't destroy file handler here.
Fix Coverity id #331814.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr
10c27b28a7 (load_group): fix use after free.
Found by Coverity.
Coverity id #331812.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr
c15b752fbf (exec_extension): fix memory leak.
Found by Coverity.
Coverity id #331829.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr
4db80f3010 (dir_list_reload): fix resource leak.
Found by Coverity.
Coverity id #331809.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
5b7b48e1db mcedit: move macros-related stuff to editmacros.[ch].
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
0df10f488b (extfs_open_archive): fix NULL dereferences.
Fix passing NULL pointer "tmp" to g_strconcat().

Found by Coverity.
Coverity is #331840.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
2d4008655e (exec_make_shell_string): simplify condition, reduce variable scope.
Fix Coverity id #331832.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
69b8927ec9 (panel_recursive_cd_to_parent): fix memory leak.
Found by Coverity.
Coverity id #331846.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr
4070d7bee5 (apply_rules_going_right): fix deadcode.DeadStores warning.
syntax.c:523:25: warning: Value stored to 'found_right' is never read [deadcode.DeadStores]
                        found_right = TRUE;
                        ^             ~~~~

Found by Clang-11 analyzer.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr
337da4491d (edit_replace_cmd): fix deadcode.DeadStores warning.
editsearch.c:915:13: warning: Value stored to 'i' is never read [deadcode.DeadStores]
            i = edit->found_len = len;
            ^   ~~~~~~~~~~~~~~~~~~~~~

Found by Clang-11 analyzer.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr
9b752e3a2f (edit_draw_this_line): fix deadcode.DeadStores warning.
editdraw.c:536:5: warning: Value stored to 'color' is never read [deadcode.DeadStores]
    color = edit_get_syntax_color (edit, b - 1);
    ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found by Clang-11 analyzer.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
22a7ef782d (edit_do_search): search descriptor should not be NULL.
Fix of Coverity id #110818.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
a7b8d00535 (background_attention): don't use bad file descriptor.
Found by Coverity.
Coverity id #32593.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
830d6c2d48 (editcmd_dialog_raw_key_query): move to editcmd.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
b77961a14d mcedit: move all completion-related stuff to editcomplete.[ch].
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
21eefb3e36 mcedit: move all etags-related stuff to tags.[ch].
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
3a8f21166b (edit_buffer_find_word_start): rename from edit_find_word_start
...and move to editbuffer.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
9094cdd1d3 mcedit: move content of choosesyntax.c to syntax.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
c6bdc7c1dc mcedit: move all spell-related stuff to spell.[ch].
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
3b34936b9f mcedit: move all search&replace-related stuff to editsearch.[ch]. 2021-06-20 15:14:56 +03:00
Andrew Borodin
9d4eb459da (edit_search_cmd): clarify handling of NULL item of history.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
7bc1b19676 (edit_search_cmd): get rid of code duplication.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
21feb38a8d mcedit: refactoring of search.
(edit_search_init): new function: initialization of search handler.
(edit_search_deinit): new function: deinitialization of search handler.
(edit_replace_cmd): use edit_search_init().
(edit_search_cmd): likewise.
(editcmd_dialog_search_show): use edit_search_init() and
edit_search_deinit().
(edit_search_options): move definition from editcmd_dialogs.c to editsearch.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
288fe62987 (mcview_continue_search_cmd): clarify handling of NULL item of history. 2021-06-20 15:14:56 +03:00
Andrew Borodin
6adcd57859 (mcview_continue_search_cmd): get rid of string duplication.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
1fa327c5a1 (mcview_continue_search_cmd): get rid of code duplication.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
65ca3da3b2 mcviewer: refactoring of search.
(mcview_search_init): new function: initialization of search handler.
(mcview_search_deinit): new function: deinitialization of search handler.
(mcview_dialog_search): use mcview_search_init() and mcview_search_deinit().
(mcview_continue_search_cmd): use mcview_search_init().
(mcview_dialog_search): use mcview_search_deinit().
(mcview_search_options) move definition from dialogs.c to search.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
37b86b2781 (extfs_open_and_read_archive): fix NULL dereference in mc_plose().
Found by Coverity.
Coverity id #331765.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
45a4d3f6d4 mcviewer: move content of inlines.h into internal.h.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
91b7101e06 (DOZ): new macro: difference or zero.
Use DOZ where appropriate.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
d35df9ad60 Use argument names in function declarations.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
721048161c (extfs_get_plugins): use is_exe().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
de16ae9180 Use G_OPTION_ENTRY_NULL macro.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
f657d92e52 (execute_menu_command): fix memory leak.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Fredrik Fornwall
ded5d37ff0 MidnightCommander/#113: replace S_IWRITE with S_IWUSR.
S_IWRITE is an obsolete synonym provided for BSD compatibility.
It can be safely replaced with S_IWUSR.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
558fb350f8 (tar_fill_stat): fix signedness change.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
231c84caeb Widget: implement destroy callback.
(dlg_destroy): remove. Use widget_destroy() to destroy any dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
e7fab254f9 Rename variable: midnight_dlg -> filemanager.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
1e1cbb31d0 src/filemanager/chattr.c: minor refactoring.
(chattrboxes_new): create WChattrBoxes widget entirely.
(chattr_dlg_create): move creation of checkboxes to chattrboxes_new().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
ba890d9a92 (make_symlink): take paths as vfs_path_t objects
...to get rid of extra type conversions.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
6596185573 (sftpfs_fix_filename): return pointer to GString instead of pointer to char.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andreas Mohr
b71f66dbbd Fix const/unconst casts.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andrew Borodin
0718ef89f7 man2hlp: limited support of \(lq, \(rq and \(dq commands.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andrew Borodin
c2a17d3a99 (repaint_file): remove mv argument.
mv is always the inversion of isstatus.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andreas Mohr
8d84972533 (extfs_get_archive_name): fix -Wcast-qual warning.
extfs.c:799:24: warning: cast from 'const struct extfs_super_t *' to 'struct vfs_s_super *' drops const qualifier [-Wcast-qual]
        archive_name = VFS_SUPER (archive)->name;
                       ^
../../../lib/vfs/xdirentry.h:39:46: note: expanded from macro 'VFS_SUPER'
#define VFS_SUPER(a) ((struct vfs_s_super *) (a))
                                             ^

Found by Clang-11

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andreas Mohr
108c465176 (overwrite_query_dialog): fix -Wcast-qual warnings.
filegui.c:531:19: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
    s1 = (char *) file_date (ui->src_stat->st_mtime);
                  ^
filegui.c:546:19: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
    s1 = (char *) file_date (ui->dst_stat->st_mtime);
                  ^

Found by Clang-11.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andreas Mohr
34616d6444 src/filemanager/chattr.c: fix -Wcast-qual warnings.
chattr.c:398:34: warning: cast from 'const struct WChattrBoxes *' to 'struct WGroup *' drops const qualifier [-Wcast-qual]
    w = WIDGET (g_list_nth_data (GROUP (cb)->widgets, Id - cb->top));
                                 ^
../../lib/widget/group.h:16:29: note: expanded from macro 'GROUP'
#define GROUP(x) ((WGroup *)(x))
                            ^
chattr.c:515:27: warning: cast from 'const struct WChattrBoxes *' to 'struct WGroup *' drops const qualifier [-Wcast-qual]
    for (i = cb->top, l = GROUP (cb)->widgets; l != NULL; i++, l = g_list_next (l))
                          ^
../../lib/widget/group.h:16:29: note: expanded from macro 'GROUP'
#define GROUP(x) ((WGroup *)(x))
                            ^

Found by Clang-11

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andrew Borodin
443a8106f1 Ticket #4213: workaround to avoid crash on FreeBSD.
In the read_subshell_prompt() (src/subshell/common.c:1546) the first
call of select() returns 0. Therefore subshell_prompt is NULL.
NULL dereference is the cause of crash.

This commit isn't a real fix but just a workaround.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 14:59:59 +03:00
Andrew Borodin
0cb6e97230 (execute_menu_command): get rid of code duplication.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-23 10:49:10 +03:00
Lukasz Krotowski
72d2fb981a Ticket #4242: %view fails to execute on no-exec tmp filesystem.
(execute_menu_command): use indirect execution of %view.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-23 10:49:10 +03:00
Andrew Borodin
0375997c78 Ticket #4244: fix segfault on dialog before panels get visible.
If some small dialog (error message or password request) is displayed
before main mc window gets visible, the segfault occures.

The cause of segfault is update of prompt that is not created yet.

(setup_mc, create_file_manager): move creation of event channel from
setup_mc() to create_file_manager(), make that after creation of all
file manager widgets.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-18 10:23:08 +03:00
MooSE
779f30c39f Ticket #4239: extfs/u7z: support official 7z binary (7zz).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-08 16:29:33 +03:00
Andrew Borodin
8c92bec6eb Modify editor refcounter
...to fix segault introduced in daf21d8315.

Both actions MSG_INIT and MSG_DESTROY should be send to widget. In editor,
if file cannot be open, MSG_INIT isn't sent to, but MSG_DESTROY is. As a
result, a double free is occured in edit_dlg_deinit().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-30 08:54:52 +03:00
Andrew Borodin
789aa0bb22 (setup_panels): reduce the number of redraws.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:10:14 +03:00
Andrew Borodin
57fd21c7a0 (setup_panels, setup_cmdline): use WST_VISIBLE to set up prompt and command line.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:10:13 +03:00
Andrew Borodin
9ac272a287 (setup_panels): use WST_VISIBLE to set up hint bar.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:10:13 +03:00
Andrew Borodin
913403b10c Buttonbar: use WST_VISIBLE state
...instead of WButtonBar::visible member.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:10:08 +03:00
Andrew Borodin
0e75e85598 Menubar: use WST_VISIBLE state
...instead of WMenuBar::is_visible member.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:09:53 +03:00
Andrew Borodin
32621b96d1 Ticket #2252: reduce rebuld time.
The build system runs configure script after switching to another branch
or changeset, which basically means that each git operation which
modifies HEAD will cause a full rebuild. This is highly annoying, in
particular during bisecting.

Solution:
Don't define version in config.h.
Add mc_version member to mc_global_t structure and use it instead of
VERSION macro.
Now only lib/global.c depends on MC version.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 16:58:31 +03:00
Andrew Borodin
14e84cbf8e Preserve timestamp for other file types: socket, fifo, etc.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-04 10:20:50 +03:00
Andrew Borodin
109af564bc Ticket #3985: preserve timestamp for synlinks.
* (local_utime): pass AT_SYMLINK_NOFOLLOW to utimensat() to update
    timestamps of the link,  rather  than the file to which it refers.
  * (move_file_file): preserve timestamp of the link.
  * (copy_file_file): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-03 16:15:44 +03:00
Andrew Borodin
3ba4229508 (do_panelize_cd): fix memory leak.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-18 16:41:36 +03:00
Andrew Borodin
11ed948f02 (do_find): fix wrong duplication of file name.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-18 16:39:31 +03:00
Andrew Borodin
ca126b3f69 (rotate_dash): type accuracy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:24 +03:00
Andrew Borodin
d88f439a69 (mc_g_string_dup): new API that extends GString one.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:24 +03:00
Andrew Borodin
6f859e52d0 (file_entry_t): use GString instead of fname & fnamelen.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:52:39 +03:00
Andrew Borodin
536fb676d8 (vfs_path_free): add 2nd parameter...
...to free or not to free the string representation
of vfs_path_t object.

It allows to get rid of string duplication in following cases:

vfs_path_t *vpath;
char *path;
...
vpath = vfs_path_from_str (...);
path = g_strdup (vfs_path_as_str (vpath));
vfs_path_free (vpath);

Now we can write:

vfs_path_t *vpath;
char *path;
...
vpath = vfs_path_from_str (...);
path = vfs_path_free (vpath, FALSE);

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:52:39 +03:00
Andrew Borodin
6903d15b97 (init_subshell_child): use g_setenv() instead of putenv().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:52:38 +03:00
Andrew Borodin
0c02118fad Define macros for bashrc, ashrc, and inputrc files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:52:38 +03:00
Andrew Borodin
269ace6bf2 Refactoring of keymap load/save.
src/keymap.[ch]: rename from src/keybind-defaults.[ch].

(keymap_load): rename from load_keymap_defs().
(keymap_free): rename from free_keymap_defs().

Move keymap load/save functions from src/setup.c to src/keymap.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:48:59 +03:00
Andrew Borodin
7b5b56104b (show_file_history): keep order of modified history items.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:48:59 +03:00
Andrew Borodin
48dea680e6 filemanager/chattr.c: remove TODO.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:48:59 +03:00
Andrew Borodin
f29533f00f Ticket #4173: fix linking of libmc.la.
Thanks Sebastian Gniazdowski <sgniazdowski@gmail.com> for the issue.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:48:59 +03:00
Andrew Borodin
f5b813a0ab undelfs simplifications.
m4.include/vfs/mc-vfs-undelfs.m4: simplify test of required libraries.
Don't test Linux kernel specific header.

src/vfs/undelfs/undelfs.c: don't include Linux kernel specific header.
Use headers from ext2fs library only.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin
5a4d1dd122 src/args.c: fix formatting.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin
f469197c79 (edit_get_macro): refactoring.
Return position of found macro in global variable macro_list or -1 if
nothing found.

(edit_delete_macro): related changes.
(edit_execute_macro): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin
fdd3a0013f (edit_repeat_macro_cmd): refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin
d650faf774 (edit_load_macro_cmd): refactoring.
Get rid of create and free of an empty array. Create macros array if
needed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00