diff --git a/src/system/FileDescriptor.hxx b/src/system/FileDescriptor.hxx index 163418c42..3f29073ef 100644 --- a/src/system/FileDescriptor.hxx +++ b/src/system/FileDescriptor.hxx @@ -33,6 +33,8 @@ #include "check.h" #include "Compiler.h" +#include + #include #include #include @@ -75,11 +77,7 @@ public: } int Steal() noexcept { - assert(IsDefined()); - - int _fd = fd; - fd = -1; - return _fd; + return std::exchange(fd, -1); } void SetUndefined() noexcept {