[gnome-autoar] extractor: Propagate libarchive errors when only data is encrypted



commit 7268ed60110716cbd8c8d80f43eb8865d77a54e7
Author: Ignacy KuchciƄski <ignacykuchcinski gmail com>
Date:   Thu Jan 27 18:05:37 2022 +0100

    extractor: Propagate libarchive errors when only data is encrypted
    
    Currently, when trying to extract password protected 7z/RAR archives
    that don't have encrypted file lists, no error will be reported, even
    though the extraction itself fails creating empty files.
    
    To fix this situation, propagate libarchive errors by checking if
    archive_read_data_block return value is different from ARCHIVE_OK.

 gnome-autoar/autoar-extractor.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c
index e782526..cbf42bd 100644
--- a/gnome-autoar/autoar-extractor.c
+++ b/gnome-autoar/autoar-extractor.c
@@ -97,7 +97,6 @@ G_DEFINE_QUARK (autoar-extractor, autoar_extractor)
 #define BUFFER_SIZE (64 * 1024)
 #define NOT_AN_ARCHIVE_ERRNO 2013
 #define EMPTY_ARCHIVE_ERRNO 2014
-#define INCORRECT_PASSPHRASE_ERRNO 2015
 
 typedef struct _GFileAndInfo GFileAndInfo;
 
@@ -1172,12 +1171,9 @@ autoar_extractor_do_write_entry (AutoarExtractor      *self,
               autoar_extractor_signal_progress (self);
             }
 
-            if (r == ARCHIVE_FAILED) {
+            if (r != ARCHIVE_EOF) {
               if (self->error == NULL) {
-                self->error = g_error_new (AUTOAR_EXTRACTOR_ERROR,
-                                           INCORRECT_PASSPHRASE_ERRNO,
-                                           "%s",
-                                           archive_error_string (a));
+                self->error = autoar_common_g_error_new_a (a, NULL);
               }
               g_output_stream_close (ostream, self->cancellable, NULL);
               g_object_unref (ostream);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]