From e79365ec61a81bd80e8e95c41e82212fcbcaba34 Mon Sep 17 00:00:00 2001 From: Andy Warner Date: Mon, 21 Sep 2026 03:51:24 -0600 Subject: [PATCH] Move unlink of temp file to before fatal exit Ensure temporary file is deleted only on failure. As written this would never be executed. --- validator/autotrust.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validator/autotrust.c b/validator/autotrust.c index bfe0319af..c99c88abb 100644 --- a/validator/autotrust.c +++ b/validator/autotrust.c @@ -1275,9 +1275,9 @@ void autr_write_file(struct module_env* env, struct trust_anchor* tp) FlushFileBuffers((HANDLE)_get_osfhandle(_fileno(out))); #endif if(fclose(out) != 0) { + unlink(tempf); fatal_exit("could not complete write: %s: %s", fname, strerror(errno)); - unlink(tempf); return; } /* success; overwrite actual file */