mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Merge branch '3016_extfs_segfault'
* 3016_extfs_segfault: Ticket #3016: Segfault while entering into extfs archive
This commit is contained in:
commit
92817a9b60
@ -666,6 +666,7 @@ extfs_which (struct vfs_class *me, const char *path)
|
||||
static const char *
|
||||
extfs_get_path_int (const vfs_path_t * vpath, struct archive **archive, gboolean do_not_open)
|
||||
{
|
||||
char *archive_name;
|
||||
int result = -1;
|
||||
struct archive *parc;
|
||||
int fstype;
|
||||
@ -677,6 +678,8 @@ extfs_get_path_int (const vfs_path_t * vpath, struct archive **archive, gboolean
|
||||
if (fstype == -1)
|
||||
return NULL;
|
||||
|
||||
archive_name = vfs_path_to_str_elements_count (vpath, -1);
|
||||
|
||||
/*
|
||||
* All filesystems should have some local archive, at least
|
||||
* it can be PATH_SEP ('/').
|
||||
@ -684,14 +687,15 @@ extfs_get_path_int (const vfs_path_t * vpath, struct archive **archive, gboolean
|
||||
for (parc = first_archive; parc != NULL; parc = parc->next)
|
||||
if (parc->name != NULL)
|
||||
{
|
||||
if (strcmp (parc->name, vfs_path_as_str (vpath)) == 0)
|
||||
if (strcmp (parc->name, archive_name) == 0)
|
||||
{
|
||||
vfs_stamp (&vfs_extfs_ops, (vfsid) parc);
|
||||
goto return_success;
|
||||
}
|
||||
}
|
||||
|
||||
result = do_not_open ? -1 : extfs_read_archive (fstype, vfs_path_as_str (vpath), &parc);
|
||||
result = do_not_open ? -1 : extfs_read_archive (fstype, archive_name, &parc);
|
||||
g_free (archive_name);
|
||||
if (result == -1)
|
||||
{
|
||||
path_element->class->verrno = EIO;
|
||||
|
Loading…
Reference in New Issue
Block a user