style(3p/nix): Final act in the brace-wrapping saga
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.
This commit is contained in:
parent
cf40d08908
commit
3908732181
84 changed files with 2601 additions and 1554 deletions
21
third_party/nix/src/libstore/ssh.cc
vendored
21
third_party/nix/src/libstore/ssh.cc
vendored
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue