about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-04-06T15·18+0200
committerEelco Dolstra <edolstra@gmail.com>2017-04-06T15·19+0200
commit963f2bf12b4098a3b46059a26d21cdfe27662cdd (patch)
tree8f9fd12b7c317dee6fbd37322072f919071cfd45
parent6b5e2711632c345f2b6a371ef8a859106436980a (diff)
Fix bogus "unexpected Nix daemon error: interrupted by the user"
-rw-r--r--src/libutil/util.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 99a91c8cc64a..a640a64c724e 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -487,6 +487,7 @@ void readFull(int fd, unsigned char * buf, size_t count)
 void writeFull(int fd, const unsigned char * buf, size_t count, bool allowInterrupts)
 {
     while (count) {
+        if (allowInterrupts) checkInterrupt();
         ssize_t res = write(fd, (char *) buf, count);
         if (res == -1 && errno != EINTR)
             throw SysError("writing to file");
@@ -494,7 +495,6 @@ void writeFull(int fd, const unsigned char * buf, size_t count, bool allowInterr
             count -= res;
             buf += res;
         }
-        if (allowInterrupts) checkInterrupt();
     }
 }
 
@@ -1212,7 +1212,7 @@ static void signalHandlerThread(sigset_t set)
 
 void triggerInterrupt()
 {
-    _isInterrupted = 1;
+    _isInterrupted = true;
 
     {
         auto interruptCallbacks(_interruptCallbacks.lock());