Fix max fd calc and add test

This commit is contained in:
John Ericson 2020-08-20 05:08:50 +00:00
parent a83694c7a1
commit 3df78858f2
3 changed files with 18 additions and 1 deletions

View file

@ -291,7 +291,7 @@ static int _main(int argc, char * * argv)
int from = conn->from.fd; int from = conn->from.fd;
int to = conn->to.fd; int to = conn->to.fd;
auto nfds = std::max(from, to) + 1; auto nfds = std::max(from, STDIN_FILENO) + 1;
while (true) { while (true) {
fd_set fds; fd_set fds;
FD_ZERO(&fds); FD_ZERO(&fds);

View file

@ -15,6 +15,7 @@ nix_tests = \
linux-sandbox.sh \ linux-sandbox.sh \
build-dry.sh \ build-dry.sh \
build-remote-input-addressed.sh \ build-remote-input-addressed.sh \
ssh-relay.sh \
nar-access.sh \ nar-access.sh \
structured-attrs.sh \ structured-attrs.sh \
fetchGit.sh \ fetchGit.sh \

16
tests/ssh-relay.sh Normal file
View file

@ -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) ]