From 1cf11317cac2c11d20b2324d4283814f1351c1a3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 21 Aug 2020 04:00:55 +0100 Subject: refactor(tvix/libutil): Mark single-argument constructors explicit This is the clang-tidy lint 'google-explicit-constructor'. There's a whole bunch of breakage that was introduced by this, and we had to opt out a few types of this (esp. the string formatting crap). In some cases minor other changes have been done to keep the code working, instead of converting between types (e.g. an explicit comparison operator implementation for nix::Pid). Change-Id: I12e1ca51a6bc2c882dba81a2526b9729d26988e7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1832 Tested-by: BuildkiteCI Reviewed-by: kanepyork Reviewed-by: glittershark --- third_party/nix/src/libutil/archive.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'third_party/nix/src/libutil/archive.cc') diff --git a/third_party/nix/src/libutil/archive.cc b/third_party/nix/src/libutil/archive.cc index 4489b7d2a8c5..e3233d9ee4cc 100644 --- a/third_party/nix/src/libutil/archive.cc +++ b/third_party/nix/src/libutil/archive.cc @@ -45,7 +45,7 @@ PathFilter defaultPathFilter = [](const Path& /*unused*/) { return true; }; static void dumpContents(const Path& path, size_t size, Sink& sink) { sink << "contents" << size; - AutoCloseFD fd = open(path.c_str(), O_RDONLY | O_CLOEXEC); + AutoCloseFD fd(open(path.c_str(), O_RDONLY | O_CLOEXEC)); if (!fd) { throw SysError(format("opening file '%1%'") % path); } @@ -334,7 +334,8 @@ struct RestoreSink : ParseSink { void createRegularFile(const Path& path) override { Path p = dstPath + path; - fd = open(p.c_str(), O_CREAT | O_EXCL | O_WRONLY | O_CLOEXEC, 0666); + fd = AutoCloseFD( + open(p.c_str(), O_CREAT | O_EXCL | O_WRONLY | O_CLOEXEC, 0666)); if (!fd) { throw SysError(format("creating file '%1%'") % p); } -- cgit 1.4.1