From 198628790b479c7542004c62b471b1077af471a0 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Mon, 15 Dec 2025 01:22:18 +0300 Subject: [PATCH] libutil: Also fix AutoUnmount special member functions --- src/libutil/include/nix/util/file-system.hh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/libutil/include/nix/util/file-system.hh b/src/libutil/include/nix/util/file-system.hh index 7d88939e3..ba409fac8 100644 --- a/src/libutil/include/nix/util/file-system.hh +++ b/src/libutil/include/nix/util/file-system.hh @@ -480,8 +480,23 @@ class AutoUnmount Path path; bool del; public: - AutoUnmount(Path &); AutoUnmount(); + AutoUnmount(Path &); + AutoUnmount(const AutoUnmount &) = delete; + + AutoUnmount(AutoUnmount && other) noexcept + : path(std::move(other.path)) + , del(std::exchange(other.del, false)) + { + } + + AutoUnmount & operator=(AutoUnmount && other) noexcept + { + path = std::move(other.path); + del = std::exchange(other.del, false); + return *this; + } + ~AutoUnmount(); void cancel(); };