/ externals / catch / src / catch2 / internal / catch_errno_guard.cpp
catch_errno_guard.cpp
 1  
 2  //              Copyright Catch2 Authors
 3  // Distributed under the Boost Software License, Version 1.0.
 4  //   (See accompanying file LICENSE.txt or copy at
 5  //        https://www.boost.org/LICENSE_1_0.txt)
 6  
 7  // SPDX-License-Identifier: BSL-1.0
 8  
 9  #include <catch2/internal/catch_errno_guard.hpp>
10  
11  #include <cerrno>
12  
13  namespace Catch {
14          ErrnoGuard::ErrnoGuard():m_oldErrno(errno){}
15          ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; }
16  }