summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2018-04-19 15:37:25 -0600
committerAaron Ball <nullspoon@oper.io>2018-04-19 15:37:25 -0600
commit141b8bd04495aa3688f876394afdf4ea887a4ddd (patch)
tree421237d1d760ee6e673f716c5437346ff4dca1ad
parenteecbd521f95c552f537fe9f2949b36d8795c102f (diff)
downloadgpgsecure-141b8bd04495aa3688f876394afdf4ea887a4ddd.tar.gz
gpgsecure-141b8bd04495aa3688f876394afdf4ea887a4ddd.tar.xz
encarchive: early return on archive open failure
Return code 1 on failure with a error message.
-rw-r--r--c/src/encarchive.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/c/src/encarchive.c b/c/src/encarchive.c
index 45e840f..0b63484 100644
--- a/c/src/encarchive.c
+++ b/c/src/encarchive.c
@@ -88,7 +88,10 @@ int enc_archive_extract(char* srcarchive, char* dest) {
return r;
// Open the archive
- archive_read_open(a, cd, cd_open, cd_read, cd_close);
+ if(archive_read_open(a, cd, cd_open, cd_read, cd_close) < 0) {
+ printf("Error: Could not open archive '%s'\n", srcarchive);
+ return 1;
+ }
while(archive_read_next_header(a, &entry) == ARCHIVE_OK) {
archive_read_extract(a, entry, ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS);
archive_read_data_skip(a);

Generated by cgit