about summary refs log tree commit diff
path: root/src/nix-daemon
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-daemon')
-rw-r--r--src/nix-daemon/nix-daemon.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index 882078c08eb3..e678c9dfdb7c 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -294,8 +294,14 @@ static void performOp(bool trusted, unsigned int clientVersion,
 #endif
 
     case wopIsValidPath: {
-        Path path = readStorePath(from);
+	/* 'readStorePath' could raise an error leading to the connection
+	   being closed.  To be able to recover from an invalid path error,
+	   call 'startWork' early, and do 'assertStorePath' afterwards so
+	   that the 'Error' exception handler doesn't close the
+	   connection.  */
+        Path path = readString(from);
         startWork();
+	assertStorePath(path);
         bool result = store->isValidPath(path);
         stopWork();
         writeInt(result, to);