about summary refs log tree commit diff
path: root/src/nix-worker/main.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-12-04T23·29+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-12-04T23·29+0000
commit74033a844fe57e3e91c71ae37f9a65f6b2f22aa9 (patch)
treeb7bc47382b27fc8ca916ca1cbbcc8fe9aa427aaa /src/nix-worker/main.cc
parent0d40f6d7bb226e69f65f8ca8e6d0597baf3eec9a (diff)
* Add indirect root registration to the protocol so that unprivileged
  processes can register indirect roots.  Of course, there is still
  the problem that the garbage collector can only read the targets of
  the indirect roots when it's running as root...

Diffstat (limited to 'src/nix-worker/main.cc')
-rw-r--r--src/nix-worker/main.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nix-worker/main.cc b/src/nix-worker/main.cc
index c8abe14299cd..80db782e90ba 100644
--- a/src/nix-worker/main.cc
+++ b/src/nix-worker/main.cc
@@ -269,6 +269,15 @@ static void performOp(Source & from, Sink & to, unsigned int op)
         break;
     }
 
+    case wopAddIndirectRoot: {
+        Path path = absPath(readString(from));
+        startWork();
+        store->addIndirectRoot(path);
+        stopWork();
+        writeInt(1, to);
+        break;
+    }
+
     case wopSyncWithGC: {
         startWork();
         store->syncWithGC();
@@ -473,6 +482,7 @@ void run(Strings args)
     else if (daemon) {
         if (setuidMode)
             throw Error("daemon cannot be started in setuid mode");
+        chdir("/");
         daemonLoop();
     }