diff --git a/compiler/lib/ClientLib/KeySetCache.cpp b/compiler/lib/ClientLib/KeySetCache.cpp index 82adf1481..7589aa611 100644 --- a/compiler/lib/ClientLib/KeySetCache.cpp +++ b/compiler/lib/ClientLib/KeySetCache.cpp @@ -263,6 +263,7 @@ KeySetCache::loadOrGenerateSave(ClientParameters ¶ms, uint64_t seed_msb, // The lock is released when the function returns. // => any intermediate state in the function is not visible to others. auto unlockAtReturn = llvm::make_scope_exit([&]() { + llvm::sys::fs::closeFile(FD_lock); llvm::sys::fs::unlockFile(FD_lock); llvm::sys::fs::remove(lockPath); }); diff --git a/compiler/lib/Support/LLVMEmitFile.cpp b/compiler/lib/Support/LLVMEmitFile.cpp index d51afa6ed..495d35af7 100644 --- a/compiler/lib/Support/LLVMEmitFile.cpp +++ b/compiler/lib/Support/LLVMEmitFile.cpp @@ -3,6 +3,8 @@ // https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt // for license information. +#include + #include #include #include @@ -85,9 +87,12 @@ string linkerCmd(vector objectsPath, string libraryPath, string linker, } llvm::Error callCmd(string cmd) { + errno = 0; FILE *fp = popen(cmd.c_str(), "r"); - if (fp == NULL) - return StreamStringError("Cannot call the linker: " + cmd); + if (fp == NULL) { + return StreamStringError(strerror(errno)) + << "\nCannot call the linker: " << cmd; + } string outputContent; const int CHUNK_SIZE = 1024;