1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-25 19:51:00 +01:00

* Cygwin compatibility (Cygwin can't upgrade read locks to write

locks, it deadlocks when you try to do that).
This commit is contained in:
Eelco Dolstra 2008-04-10 06:53:16 +00:00
parent a599708b7a
commit f83f764218
2 changed files with 6 additions and 2 deletions

View file

@ -49,8 +49,7 @@ LocalStore::LocalStore()
checkStoreNotSymlink();
Path globalLockPath = nixDBPath + "/big-lock";
globalLock = open(globalLockPath.c_str(), O_RDWR | O_CREAT, 0666);
if (globalLock == -1) throw SysError(format("opening file `%1%'") % globalLockPath);
globalLock = openLockFile(globalLockPath.c_str(), true);
if (!lockFile(globalLock, ltRead, false)) {
printMsg(lvlError, "waiting for the big Nix store lock...");

View file

@ -22,6 +22,11 @@ void LocalStore::upgradeStore12()
{
#if OLD_DB_COMPAT
#ifdef __CYGWIN__
/* Cygwin can't upgrade a read lock to a write lock... */
lockFile(globalLock, ltNone, true);
#endif
if (!lockFile(globalLock, ltWrite, false)) {
printMsg(lvlError, "waiting for exclusive access to the Nix store...");
lockFile(globalLock, ltWrite, true);