[gnome-autoar] extractor: Use specific error code when passphrase wasn't provided
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-autoar] extractor: Use specific error code when passphrase wasn't provided
- Date: Mon, 27 Jun 2022 11:40:49 +0000 (UTC)
commit 3255f65b7c04ac2bcdf547ed2f272d35c4c903b1
Author: Sergio Costas Rodriguez <sergio costas canonical com>
Date: Tue Jun 14 10:44:21 2022 +0200
extractor: Use specific error code when passphrase wasn't provided
The extraction fails with generic libarchive error code when passphrase was
requested, but not provided. Let's add specific error code for that case
to allow clients to handle this case concretely.
Relates: https://gitlab.gnome.org/GNOME/gnome-autoar/-/issues/42
gnome-autoar/autoar-extractor.c | 6 ++++++
gnome-autoar/autoar-extractor.h | 1 +
2 files changed, 7 insertions(+)
---
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c
index e34fec2..f139116 100644
--- a/gnome-autoar/autoar-extractor.c
+++ b/gnome-autoar/autoar-extractor.c
@@ -1694,6 +1694,12 @@ autoar_extractor_step_scan_toplevel (AutoarExtractor *self)
if (g_cancellable_is_cancelled (self->cancellable)) {
archive_read_free (a);
return;
+ } else if (self->passphrase == NULL) {
+ self->error = g_error_new_literal (AUTOAR_EXTRACTOR_ERROR,
+ AUTOAR_PASSPHRASE_REQUIRED_ERRNO,
+ "A passphrase is required");
+ archive_read_free (a);
+ return;
}
}
diff --git a/gnome-autoar/autoar-extractor.h b/gnome-autoar/autoar-extractor.h
index 5b19ad0..77f5e91 100644
--- a/gnome-autoar/autoar-extractor.h
+++ b/gnome-autoar/autoar-extractor.h
@@ -46,6 +46,7 @@ G_DECLARE_FINAL_TYPE (AutoarExtractor, autoar_extractor, AUTOAR, EXTRACTOR, GObj
#define AUTOAR_NOT_AN_ARCHIVE_ERRNO 2013
#define AUTOAR_EMPTY_ARCHIVE_ERRNO 2014
+#define AUTOAR_PASSPHRASE_REQUIRED_ERRNO 2015
GQuark autoar_extractor_quark (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]