about summary refs log tree commit diff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-12-04T17·17+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-12-04T17·17+0000
commit0130ef88ea280e67037fa76bcedc59db17d9a8ca (patch)
tree120a616c9a9ee296d2c1832f1b238c281df016ae /src/libutil/util.cc
parent4740baf3a61c48c07f12f23927c84ca9892088a8 (diff)
* Daemon mode (`nix-worker --daemon'). Clients connect to the server
  via the Unix domain socket in /nix/var/nix/daemon.socket.  The
  server forks a worker process per connection.
* readString(): use the heap, not the stack.
* Some protocol fixes.

Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 7c1138720cd3..08385e5d96e0 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -191,18 +191,6 @@ Strings readDirectory(const Path & path)
 }
 
 
-template <class T>
-struct AutoDeleteArray
-{
-    T * p;
-    AutoDeleteArray(T * p) : p(p) { }
-    ~AutoDeleteArray() 
-    {
-        delete [] p;
-    }
-};
-
-
 string readFile(int fd)
 {
     struct stat st;
@@ -468,7 +456,7 @@ void readFull(int fd, unsigned char * buf, size_t count)
             if (errno == EINTR) continue;
             throw SysError("reading from file");
         }
-        if (res == 0) throw Error("unexpected end-of-file");
+        if (res == 0) throw EndOfFile("unexpected end-of-file");
         count -= res;
         buf += res;
     }
@@ -707,6 +695,7 @@ int Pid::wait(bool block)
         if (res == 0 && !block) return -1;
         if (errno != EINTR)
             throw SysError("cannot get child exit status");
+        checkInterrupt();
     }
 }
 
@@ -793,7 +782,7 @@ void _interrupted()
        kills the program! */
     if (!std::uncaught_exception()) {
         _isInterrupted = 0;
-        throw Error("interrupted by the user");
+        throw Interrupted("interrupted by the user");
     }
 }