diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-20T21·27+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-20T21·27+0100 |
commit | 689ef502f5b0655c9923ed77da2ae3504630f473 (patch) | |
tree | 3e331c153646f136875f047cc3b9f0aad8c86341 /third_party/nix/src/libstore/ssh.cc | |
parent | d331d3a0b5c497a46e2636f308234be66566c04c (diff) |
refactor(3p/nix): Apply clang-tidy's readability-* fixes r/788
This applies the readability fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html
Diffstat (limited to 'third_party/nix/src/libstore/ssh.cc')
-rw-r--r-- | third_party/nix/src/libstore/ssh.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/third_party/nix/src/libstore/ssh.cc b/third_party/nix/src/libstore/ssh.cc index d549d5c3657b..06aaf285f1b5 100644 --- a/third_party/nix/src/libstore/ssh.cc +++ b/third_party/nix/src/libstore/ssh.cc @@ -12,7 +12,7 @@ SSHMaster::SSHMaster(const std::string& host, std::string keyFile, useMaster(useMaster && !fakeSSH), compress(compress), logFD(logFD) { - if (host == "" || hasPrefix(host, "-")) { + if (host.empty() || hasPrefix(host, "-")) { throw Error("invalid SSH host name '%s'", host); } } @@ -33,7 +33,8 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand( const std::string& command) { Path socketPath = startMaster(); - Pipe in, out; + Pipe in; + Pipe out; in.create(); out.create(); @@ -63,9 +64,9 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand( if (fakeSSH) { args = {"bash", "-c"}; } else { - args = {"ssh", host.c_str(), "-x", "-a"}; + args = {"ssh", host, "-x", "-a"}; addCommonSSHOpts(args); - if (socketPath != "") { + if (!socketPath.empty()) { args.insert(args.end(), {"-S", socketPath}); } // TODO(tazjin): Abseil verbosity flag @@ -123,7 +124,7 @@ Path SSHMaster::startMaster() { throw SysError("duping over stdout"); } - Strings args = {"ssh", host.c_str(), + Strings args = {"ssh", host, "-M", "-N", "-S", state->socketPath, "-o", "LocalCommand=echo started", |