aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-08-20 05:08:50 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-08-20 05:08:50 +0000
commit3df78858f2ad91a80e30ba910119a0c16c05c66a (patch)
treee3956e944eaf4fe9617b60452452dc332eb2bf09
parenta83694c7a1212567ec2f032f84c0d72722bcf5ea (diff)
Fix max fd calc and add test
-rw-r--r--src/nix-daemon/nix-daemon.cc2
-rw-r--r--tests/local.mk1
-rw-r--r--tests/ssh-relay.sh16
3 files changed, 18 insertions, 1 deletions
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index bdf56d2e2..6e652ccbf 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -291,7 +291,7 @@ static int _main(int argc, char * * argv)
int from = conn->from.fd;
int to = conn->to.fd;
- auto nfds = std::max(from, to) + 1;
+ auto nfds = std::max(from, STDIN_FILENO) + 1;
while (true) {
fd_set fds;
FD_ZERO(&fds);
diff --git a/tests/local.mk b/tests/local.mk
index 53035da41..fd9438386 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -15,6 +15,7 @@ nix_tests = \
linux-sandbox.sh \
build-dry.sh \
build-remote-input-addressed.sh \
+ ssh-relay.sh \
nar-access.sh \
structured-attrs.sh \
fetchGit.sh \
diff --git a/tests/ssh-relay.sh b/tests/ssh-relay.sh
new file mode 100644
index 000000000..dce50974b
--- /dev/null
+++ b/tests/ssh-relay.sh
@@ -0,0 +1,16 @@
+source common.sh
+
+echo foo > $TEST_ROOT/hello.sh
+
+ssh_localhost=ssh://localhost
+remote_store=?remote-store=$ssh_localhost
+
+store=$ssh_localhost
+
+store+=$remote_store
+store+=$remote_store
+store+=$remote_store
+
+out=$(nix add-to-store --store "$store" $TEST_ROOT/hello.sh)
+
+[ foo = $(< $out) ]