Browse Source

Merge branch '4560_extfs_open_deleted_archive'

* 4560_extfs_open_deleted_archive:
  Ticket #4560: extfs: fix segfault om enter to deleted archive.
Andrew Borodin 8 months ago
parent
commit
b68243df1e
1 changed files with 11 additions and 3 deletions
  1. 11 3
      src/vfs/extfs/extfs.c

+ 11 - 3
src/vfs/extfs/extfs.c

@@ -531,7 +531,10 @@ extfs_open_archive (int fstype, const char *name, struct extfs_super_t **pparc,
     if (info->need_archive)
     {
         if (mc_stat (name_vpath, &mystat) == -1)
+        {
+            mc_propagate_error (error, 0, "%s", unix_error_string (errno));
             goto ret;
+        }
 
         if (!vfs_file_is_local (name_vpath))
         {
@@ -737,9 +740,14 @@ extfs_open_and_read_archive (int fstype, const char *name, struct extfs_super_t
         const extfs_plugin_info_t *info;
 
         info = &g_array_index (extfs_plugins, extfs_plugin_info_t, fstype);
-        message (D_ERROR, MSG_ERROR, _("Cannot open %s archive\n%s:\n%s"), info->prefix, name,
-                 error->message);
-        g_error_free (error);
+        if (error == NULL)
+            message (D_ERROR, MSG_ERROR, _("Cannot open %s archive\n%s"), info->prefix, name);
+        else
+        {
+            message (D_ERROR, MSG_ERROR, _("Cannot open %s archive\n%s:\n%s"), info->prefix, name,
+                     error->message);
+            g_error_free (error);
+        }
     }
     else
     {