about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libstore/build.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index ed53f48aa001..6d0498968d0d 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -12,6 +12,10 @@
 #include <unistd.h>
 #include <errno.h>
 
+#ifdef __CYGWIN__
+#include <windows.h>
+#endif
+
 #include <pwd.h>
 #include <grp.h>
 
@@ -317,6 +321,13 @@ const char * * strings2CharPtrs(const Strings & ss)
 }
 
 
+/* Hack for Cygwin: _exit() doesn't seem to work quite right, since
+   some Berkeley DB code appears to be called when a child exits
+   through _exit() (e.g., because execve() failed).  So call the
+   Windows API directly. */
+#define _exit(n) ExitProcess(n)
+
+
 
 //////////////////////////////////////////////////////////////////////