diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2017-06-30T17·50+0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-30T17·50+0200 |
commit | 63d6e0ad3f0a93305cebc870dbb3639506727b27 (patch) | |
tree | 4f1e98c423ac78ddf8d954111dea95d62bce5fc5 | |
parent | c7346a275c4cdcb59b3961241ddc52b79452d716 (diff) | |
parent | 596b0e0a045eb953b5ed3328d5ae8eb636e31373 (diff) |
Merge pull request #1417 from corngood/cygwin-fix
Call SetDllDirectory("") after sqlite3 init on cygwin
-rw-r--r-- | src/libstore/local-store.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 74c74e672e25..c76294dcccb4 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -30,6 +30,10 @@ #include <sys/xattr.h> #endif +#ifdef __CYGWIN__ +#include <windows.h> +#endif + #include <sqlite3.h> @@ -281,6 +285,16 @@ void LocalStore::openDB(State & state, bool create) SQLITE_OPEN_READWRITE | (create ? SQLITE_OPEN_CREATE : 0), 0) != SQLITE_OK) throw Error(format("cannot open Nix database ‘%1%’") % dbPath); +#ifdef __CYGWIN__ + /* The cygwin version of sqlite3 has a patch which calls + SetDllDirectory("/usr/bin") on init. It was intended to fix extension + loading, which we don't use, and the effect of SetDllDirectory is + inherited by child processes, and causes libraries to be loaded from + /usr/bin instead of $PATH. This breaks quite a few things (e.g. + checkPhase on openssh), so we set it back to default behaviour. */ + SetDllDirectoryW(L""); +#endif + if (sqlite3_busy_timeout(db, 60 * 60 * 1000) != SQLITE_OK) throwSQLiteError(db, "setting timeout"); |