From: Alberto Leiva Popper Date: Tue, 14 Nov 2023 21:41:11 +0000 (-0600) Subject: Remove tmp directory step from --init-tals/--init-as0-tals X-Git-Tag: 1.6.0~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bec7fe108e0e46522f8817d53728aae4f4aa0b27;p=thirdparty%2FFORT-validator.git Remove tmp directory step from --init-tals/--init-as0-tals The code that handles these flags does not run with a cache context, so the temporal file step was causing cache download issues despite being completely unneeded. --- diff --git a/src/http/http.c b/src/http/http.c index 34fafdd4..b02b54ee 100644 --- a/src/http/http.c +++ b/src/http/http.c @@ -459,27 +459,5 @@ int http_direct_download(char const *remote, char const *dest) { bool changed; - char *tmp_file; - int error; - - error = cache_tmpfile(&tmp_file); - if (error) - return error; - - error = http_fetch(remote, tmp_file, 0, &changed); - if (error) - goto end; - - /* Overwrite the original file */ - pr_val_debug("Moving %s to %s.", tmp_file, dest); - error = rename(tmp_file, dest); - if (error) { - error = errno; - pr_val_err("Renaming temporal file from '%s' to '%s': %s", - tmp_file, dest, strerror(error)); - goto end; - } - -end: free(tmp_file); - return error; + return http_fetch(remote, dest, 0, &changed); } diff --git a/src/thread_var.c b/src/thread_var.c index f7be969c..1cc35be9 100644 --- a/src/thread_var.c +++ b/src/thread_var.c @@ -69,8 +69,8 @@ state_store(struct validation *state) } /* - * Returns the current thread's validation state. Never returns NULL by - * contract. + * Returns the current thread's validation state. Should not be used outside of + * validation threads. */ struct validation * state_retrieve(void)