mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Merge branch '2976_broken_magic_mode'
* 2976_broken_magic_mode: Ticket #2976: magic mode is broken in mcview.
This commit is contained in:
commit
68d5b0d610
@ -375,10 +375,26 @@ mcview_load (mcview_t * view, const char *command, const char *file, int start_l
|
|||||||
if (view->magic_mode && (type != COMPRESSION_NONE))
|
if (view->magic_mode && (type != COMPRESSION_NONE))
|
||||||
{
|
{
|
||||||
char *tmp_filename;
|
char *tmp_filename;
|
||||||
|
vfs_path_t *vpath1;
|
||||||
|
int fd1;
|
||||||
|
|
||||||
vfs_path_free (view->filename_vpath);
|
|
||||||
tmp_filename = g_strconcat (file, decompress_extension (type), (char *) NULL);
|
tmp_filename = g_strconcat (file, decompress_extension (type), (char *) NULL);
|
||||||
view->filename_vpath = vfs_path_from_str (tmp_filename);
|
vpath1 = vfs_path_from_str (tmp_filename);
|
||||||
|
fd1 = mc_open (vpath1, O_RDONLY | O_NONBLOCK);
|
||||||
|
if (fd1 == -1)
|
||||||
|
{
|
||||||
|
g_snprintf (tmp, sizeof (tmp), _("Cannot open \"%s\" in magic mode\n%s"),
|
||||||
|
file, unix_error_string (errno));
|
||||||
|
mcview_show_error (view, tmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mc_close (fd);
|
||||||
|
fd = fd1;
|
||||||
|
mc_fstat (fd, &st);
|
||||||
|
}
|
||||||
|
vfs_path_free (vpath1);
|
||||||
|
|
||||||
g_free (tmp_filename);
|
g_free (tmp_filename);
|
||||||
}
|
}
|
||||||
mcview_set_datasource_file (view, fd, &st);
|
mcview_set_datasource_file (view, fd, &st);
|
||||||
|
Loading…
Reference in New Issue
Block a user