diff --git a/crypto/test/file_util.h b/crypto/test/file_util.h index 9d3d76e3e62..376e151287c 100644 --- a/crypto/test/file_util.h +++ b/crypto/test/file_util.h @@ -46,12 +46,15 @@ class ScopedFD { explicit ScopedFD(int fd) : fd_(fd) {} ~ScopedFD() { reset(); } - ScopedFD(ScopedFD &&other) { *this = std::move(other); } - ScopedFD &operator=(ScopedFD other) { + ScopedFD(ScopedFD &&other) noexcept { *this = std::move(other); } + ScopedFD &operator=(ScopedFD&& other) { reset(other.release()); return *this; } + ScopedFD(const ScopedFD &other) = delete; + ScopedFD &operator=(ScopedFD& other) = delete; + bool is_valid() const { return fd_ >= 0; } int get() const { return fd_; }