diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-19T19·47+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-19T19·51+0100 |
commit | 39087321811e81e26a1a47d6967df1088dcf0e95 (patch) | |
tree | 57110be423eeb7869e9960466f4b17c0ea7cd961 /third_party/nix/src/libstore/ssh.cc | |
parent | cf40d08908ede4061eb15513b770c98877844b8b (diff) |
style(3p/nix): Final act in the brace-wrapping saga r/777
This last change set was generated by a full clang-tidy run (including compilation): clang-tidy -p ~/projects/nix-build/ \ -checks=-*,readability-braces-around-statements -fix src/*/*.cc Actually running clang-tidy requires some massaging to make it play nice with Nix + meson, I'll be adding a wrapper or something for that soon.
Diffstat (limited to 'third_party/nix/src/libstore/ssh.cc')
-rw-r--r-- | third_party/nix/src/libstore/ssh.cc | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/third_party/nix/src/libstore/ssh.cc b/third_party/nix/src/libstore/ssh.cc index 20add33c0046..1783732a1db5 100644 --- a/third_party/nix/src/libstore/ssh.cc +++ b/third_party/nix/src/libstore/ssh.cc @@ -10,13 +10,15 @@ SSHMaster::SSHMaster(const std::string& host, const std::string& keyFile, useMaster(useMaster && !fakeSSH), compress(compress), logFD(logFD) { - if (host == "" || hasPrefix(host, "-")) + if (host == "" || hasPrefix(host, "-")) { throw Error("invalid SSH host name '%s'", host); + } } void SSHMaster::addCommonSSHOpts(Strings& args) { - for (auto& i : tokenizeString<Strings>(getEnv("NIX_SSHOPTS"))) + for (auto& i : tokenizeString<Strings>(getEnv("NIX_SSHOPTS"))) { args.push_back(i); + } if (!keyFile.empty()) { args.insert(args.end(), {"-i", keyFile}); } @@ -44,12 +46,15 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand( close(in.writeSide.get()); close(out.readSide.get()); - if (dup2(in.readSide.get(), STDIN_FILENO) == -1) + if (dup2(in.readSide.get(), STDIN_FILENO) == -1) { throw SysError("duping over stdin"); - if (dup2(out.writeSide.get(), STDOUT_FILENO) == -1) + } + if (dup2(out.writeSide.get(), STDOUT_FILENO) == -1) { throw SysError("duping over stdout"); - if (logFD != -1 && dup2(logFD, STDERR_FILENO) == -1) + } + if (logFD != -1 && dup2(logFD, STDERR_FILENO) == -1) { throw SysError("duping over stderr"); + } Strings args; @@ -112,8 +117,9 @@ Path SSHMaster::startMaster() { close(out.readSide.get()); - if (dup2(out.writeSide.get(), STDOUT_FILENO) == -1) + if (dup2(out.writeSide.get(), STDOUT_FILENO) == -1) { throw SysError("duping over stdout"); + } Strings args = {"ssh", host.c_str(), "-M", "-N", @@ -136,8 +142,9 @@ Path SSHMaster::startMaster() { } catch (EndOfFile& e) { } - if (reply != "started") + if (reply != "started") { throw Error("failed to start SSH master connection to '%s'", host); + } return state->socketPath; } |