Skip to content

Commit

Permalink
Fix tests fail, misc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Mar 20, 2020
1 parent 7a6d76d commit c1f1e6f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/libstore/ssh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
namespace nix {

SSHMaster::SSHMaster(const std::string & hostNport, const std::string & keyFile, bool useMaster, bool compress, int logFD)
: fakeSSH(host == "localhost")
, keyFile(keyFile)
: keyFile(keyFile)
, useMaster(useMaster && !fakeSSH)
, compress(compress)
, logFD(logFD)
{
auto res = split(hostNport, *":");
port = res.size() > 0 ? atoi(res[1].c_str()) : 0;
auto res = split(hostNport, ':');
port = res.size() > 1 ? atoi(res[1].c_str()) : 0; // if we have a port, parse that
host = res[0];

// help: is this above already using the actual value or is it broken without this
fakeSSH = host == "localhost";
fakeSSH = host == "localhost" && !port;

if (host == "" || hasPrefix(host, "-"))
throw Error("invalid SSH host name '%s'", host);
Expand Down

0 comments on commit c1f1e6f

Please sign in to comment.