fix race with getStore() (#45)
by calling it once before starting the server closes: #44
This commit is contained in:
parent
7b7cf5cd08
commit
1d21f73a2d
@ -37,6 +37,12 @@ static ref<Store> getStore()
|
||||
|
||||
extern "C" {
|
||||
|
||||
// Must be called once before the server is stated to avoid races
|
||||
void initStore()
|
||||
{
|
||||
getStore();
|
||||
}
|
||||
|
||||
void freeString(struct string * const input)
|
||||
{
|
||||
free((void *) input->data);
|
||||
|
@ -341,6 +341,8 @@ main = do
|
||||
options@Options{ priority, timeout, verbosity } <- do
|
||||
Options.execParser Options.parserInfo
|
||||
|
||||
Nix.initStore
|
||||
|
||||
storeDirectory <- Nix.getStoreDir
|
||||
|
||||
secretKeyFile <- Environment.lookupEnv "NIX_SECRET_KEY_FILE"
|
||||
|
@ -34,6 +34,8 @@ import qualified Foreign
|
||||
|
||||
#include "nix.hh"
|
||||
|
||||
foreign import ccall "initStore" initStore :: IO ()
|
||||
|
||||
foreign import ccall "freeString" freeString :: Ptr String_ -> IO ()
|
||||
|
||||
data String_ = String_ { data_ :: Ptr CChar, size :: CSize }
|
||||
|
Loading…
x
Reference in New Issue
Block a user