diff --git a/test/TestUtil.h b/test/TestUtil.h index 1c06523..c4ac55b 100644 --- a/test/TestUtil.h +++ b/test/TestUtil.h @@ -34,8 +34,13 @@ namespace test explicit DisableStream(FILE* handle) : fileDescriptor(dup(streamFd)), fileHandle(handle) { + if (fileDescriptor < 0) + { + throw std::runtime_error{"failed to dup() stream"}; + } fflush(fileHandle); - if (const auto rtn = freopen("NUL", "a", fileHandle); rtn == nullptr) + + if (const auto* rtn = freopen("NUL", "a", fileHandle); rtn == nullptr) { throw std::runtime_error{"failed to redirect stream"}; }