Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

report tarball extraction errors

In particular, we care about ENOSPC.
  • Loading branch information...
commit 58c19d16f92c1a55d350c8495cac878a92ba8df7 1 parent 46dee5d
@falconindy authored
Showing with 13 additions and 9 deletions.
  1. +13 −9 cower.c
View
22 cower.c
@@ -489,7 +489,7 @@ int archive_extract_file(const struct response_t *file) /* {{{ */
struct archive *archive;
struct archive_entry *entry;
const int archive_flags = ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_TIME;
- int ok, ret = ARCHIVE_OK;
+ int ok, ret = 0;
archive = archive_read_new();
archive_read_support_compression_all(archive);
@@ -500,8 +500,11 @@ int archive_extract_file(const struct response_t *file) /* {{{ */
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
ok = archive_read_extract(archive, entry, archive_flags);
/* NOOP ON ARCHIVE_{OK,WARN,RETRY} */
- if(ok == ARCHIVE_FATAL || ok == ARCHIVE_EOF) {
- ret = ok;
+ if(ok == ARCHIVE_FATAL || ok == ARCHIVE_WARN) {
+ ret = archive_errno(archive);
+ break;
+ } else if (ok == ARCHIVE_EOF) {
+ ret = 0;
break;
}
}
@@ -760,18 +763,19 @@ void *download(CURL *curl, void *arg) /* {{{ */
(const char*)arg, httpcode);
goto finish;
}
- cwr_printf(LOG_BRIEF, BRIEF_OK "\t%s\t", result->name);
- cwr_printf(LOG_INFO, "%s%s%s downloaded to %s\n",
- colstr->pkg, result->name, colstr->nc, cfg.dlpath);
ret = archive_extract_file(&response);
- if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) {
+ if(ret != 0) {
cwr_fprintf(stderr, LOG_BRIEF, BRIEF_ERR "\t%s\t", (const char*)arg);
- cwr_fprintf(stderr, LOG_ERROR, "[%s]: failed to extract tarball\n",
- (const char*)arg);
+ cwr_fprintf(stderr, LOG_ERROR, "[%s]: failed to extract tarball: %s\n",
+ (const char*)arg, strerror(ret));
goto finish;
}
+ cwr_printf(LOG_BRIEF, BRIEF_OK "\t%s\t", result->name);
+ cwr_printf(LOG_INFO, "%s%s%s downloaded to %s\n",
+ colstr->pkg, result->name, colstr->nc, cfg.dlpath);
+
if(cfg.getdeps) {
resolve_dependencies(curl, arg);
}
Please sign in to comment.
Something went wrong with that request. Please try again.