From 93e89b3b7efeaa41f4f11fbb022b962d2244dab2 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 13 Apr 2019 12:33:29 +0200 Subject: [PATCH] don't close cache manifest file prematurely ErrorInvalidFormat is not a fatal error so don't close the cache manifest file right away but instead let cache_final() handle it. Fixes the following (very common) warning when running the test suite: Warning: Unable to write cache file [..]: unexpected seek failure The seek failure is an lseek() system call that failed with EBADF because the file descriptor had already been closed. --- src/cache_hash.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cache_hash.cpp b/src/cache_hash.cpp index 250733ec92..efb1a06b59 100644 --- a/src/cache_hash.cpp +++ b/src/cache_hash.cpp @@ -437,7 +437,7 @@ Error cache_hit(CacheHash *ch, Buf *out_digest) { return ErrorCacheUnavailable; } } - if (return_code != ErrorNone) { + if (return_code != ErrorNone && return_code != ErrorInvalidFormat) { os_file_close(&ch->manifest_file); } return return_code;