From 23e0533ea1ad6949848b4abb59da62e4c52988f7 Mon Sep 17 00:00:00 2001 From: Mario Campos Date: Wed, 13 Mar 2024 07:15:12 +0100 Subject: [PATCH] core: remove unnecessary call to stat() in hash file function The call to fopen() will fail anyway if the file doesn't exist. --- src/core/core-crypto.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/core/core-crypto.c b/src/core/core-crypto.c index c6619e2f4..709b46201 100644 --- a/src/core/core-crypto.c +++ b/src/core/core-crypto.c @@ -285,7 +285,6 @@ weecrypto_hash_file (const char *filename, int hash_algo, void *hash, int *hash_size) { gcry_md_hd_t *hd_md; - struct stat st; FILE *file; size_t num_read; int rc, hd_md_opened, algo_size; @@ -306,9 +305,6 @@ weecrypto_hash_file (const char *filename, int hash_algo, if (!filename || !filename[0] || !hash) goto hash_end; - if (stat (filename, &st) == -1) - goto hash_end; - file = fopen (filename, "r"); if (!file) goto hash_end;