aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2020-01-22 21:18:45 -0500
committerJason Woodward2020-01-22 21:19:10 -0500
commitc198f6a265666ed348eff0ab07cb4c08da87a74f (patch)
tree270b9f93635df8ecf1ed7f4be1540c745e2997d0
parent0fae7af6f5fd3fc36cdf5d2e7b6d97989f970f69 (diff)
downloadslapt-src-c198f6a265666ed348eff0ab07cb4c08da87a74f.tar.gz
handle failure to get a head request for file:// urls, and better report download errors
-rw-r--r--src/source.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/source.c b/src/source.c
index 0a9de39..82422ce 100644
--- a/src/source.c
+++ b/src/source.c
@@ -196,7 +196,7 @@ bool slapt_src_update_slackbuild_cache(slapt_src_config *config)
if (head != NULL && local_head != NULL && strcmp(head, local_head) == 0) {
printf(gettext("Cached\n"));
sbs = slapt_src_get_slackbuilds_from_file(filename);
- } else if (head != NULL) {
+ } else {
if ((f = slapt_open_file(filename, "w+b")) == NULL)
exit(EXIT_FAILURE);
@@ -207,18 +207,22 @@ bool slapt_src_update_slackbuild_cache(slapt_src_config *config)
printf(gettext("Done\n"));
sbs = slapt_src_get_slackbuilds_from_file(filename);
- slapt_write_head_cache(head, filename);
+ if (head != NULL)
+ slapt_write_head_cache(head, filename);
+
+ break;
} else {
- fprintf(stderr, gettext("Download failed: %s\n"), err);
slapt_clear_head_cache(filename);
- rval = false;
}
- } else {
- if (strcmp(files[fc], SLAPT_SRC_SOURCES_LIST_GZ) != 0) {
+ }
+ if (strcmp(files[fc], SLAPT_SRC_SOURCES_LIST_GZ) != 0) {
+ if (err) {
+ fprintf(stderr, gettext("Download failed: %s\n"), err);
+ } else {
fprintf(stderr, gettext("Download failed: %s\n"), "404");
- rval = false;
}
+ rval = false;
}
free(filename);