From 689ef502f5b0655c9923ed77da2ae3504630f473 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 20 May 2020 22:27:37 +0100 Subject: refactor(3p/nix): Apply clang-tidy's readability-* fixes This applies the readability fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html --- third_party/nix/src/libstore/ssh.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'third_party/nix/src/libstore/ssh.cc') 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::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::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", -- cgit 1.4.1