From 6e95d64b8affdadbe97239c49b17bdee39a72618 Mon Sep 17 00:00:00 2001 From: Otavio Pontes Date: Thu, 19 Mar 2020 12:53:52 -0700 Subject: [PATCH] version: Signature check shouldn't fail when we can't get the sig size Getting the size of a file is not always supported by the webserver, so we should try to assume a value to download the signature. 4k is good enough for the signature used by default for swupd/mixer. Signed-off-by: Otavio Pontes --- src/version.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/version.c b/src/version.c index 3f58fa13..f499bc0e 100644 --- a/src/version.c +++ b/src/version.c @@ -94,14 +94,14 @@ out: static int get_sig_inmemory(char *url, struct curl_file_data *tmp_version_sig) { + static const int sig_size = 4096; int ret = -1; char *sig_fname; string_or_die(&sig_fname, "%s.sig", url); ret = swupd_curl_query_content_size(sig_fname); if (ret <= 0) { - warn("Failed to retrieve size for signature file: %s\n", sig_fname); - ret = -ENOENT; - goto exit; + debug("Failed to retrieve size for signature file: %s - assuming %d\n", sig_fname, sig_size); + ret = sig_size; } tmp_version_sig->capacity = ret; @@ -111,7 +111,7 @@ static int get_sig_inmemory(char *url, struct curl_file_data *tmp_version_sig) ret = swupd_curl_get_file_memory(sig_fname, tmp_version_sig); if (ret != 0) { - warn("Failed to fetch signature file in memory: %s\n", sig_fname); + debug("Failed to fetch signature file in memory: %s\n", sig_fname); free_and_clear_pointer(&tmp_version_sig->data); tmp_version_sig->data = NULL; ret = -ENOENT;