From 369ed71858b50529242fd0b9d274cc13b96ded05 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sat, 24 Jul 2021 09:19:48 +0000 Subject: [PATCH] libutil: use uniform initialization in _deletePath Otherwise I get a compiler error when building for NetBSD: src/libutil/util.cc: In function 'void nix::_deletePath(const Path&, uint64_t&)': src/libutil/util.cc:438:17: error: base operand of '->' is not a pointer 438 | AutoCloseFD dirfd(open(dir.c_str(), O_RDONLY)); | ^~~~~ src/libutil/util.cc:439:10: error: 'dirfd' was not declared in this scope 439 | if (!dirfd) { | ^~~~~ src/libutil/util.cc:444:17: error: 'dirfd' was not declared in this scope 444 | _deletePath(dirfd.get(), path, bytesFreed); | ^~~~~ --- src/libutil/util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libutil/util.cc b/src/libutil/util.cc index b8334defc..d876315c8 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -435,7 +435,7 @@ static void _deletePath(const Path & path, uint64_t & bytesFreed) if (dir == "") dir = "/"; - AutoCloseFD dirfd(open(dir.c_str(), O_RDONLY)); + AutoCloseFD dirfd{open(dir.c_str(), O_RDONLY)}; if (!dirfd) { if (errno == ENOENT) return; throw SysError("opening directory '%1%'", path);