1 /* 2 * Created by Martin on 06/03/2017. 3 * 4 * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 */ 7 #ifndef TWOBLUECUBES_CATCH_ERRNO_GUARD_HPP_INCLUDED 8 #define TWOBLUECUBES_CATCH_ERRNO_GUARD_HPP_INCLUDED 9 10 #include <cerrno> 11 12 13 namespace Catch { 14 15 class ErrnoGuard { 16 public: ErrnoGuard()17 ErrnoGuard():m_oldErrno(errno){} ~ErrnoGuard()18 ~ErrnoGuard() { errno = m_oldErrno; } 19 private: 20 int m_oldErrno; 21 }; 22 23 } 24 25 #endif // TWOBLUECUBES_CATCH_ERRNO_GUARD_HPP_INCLUDED 26