0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 12:12:15 +02:00

Use openvpn::strerror_str() instead of std::strerror().

std::strerror() doesn't claim to be thread-safe, so
add openvpn::strerror_str() which is thread-safe by
virtue of the fact that it backs to strerror_r().

Signed-off-by: James Yonan <james@openvpn.net>
This commit is contained in:
James Yonan 2017-04-22 18:02:11 -06:00 committed by David Sommerseth
parent eaa24e939e
commit 5f9c70c704
No known key found for this signature in database
GPG Key ID: 86CF944C9671FDF2

View File

@ -21,6 +21,7 @@
#include <errno.h>
#include <openvpn/common/exception.hpp>
#include <openvpn/common/strerror.hpp>
namespace openvpn {
@ -65,7 +66,7 @@ namespace openvpn {
if (status < 0)
{
const int eno = errno;
OPENVPN_THROW(xmit_fd_error, "xmit_fd: " << std::strerror(eno));
OPENVPN_THROW(xmit_fd_error, "xmit_fd: " << strerror_str(eno));
}
else if (status != message.length())
OPENVPN_THROW(xmit_fd_error, "xmit_fd: unexpected send size");
@ -92,7 +93,7 @@ namespace openvpn {
if (status < 0)
{
const int eno = errno;
OPENVPN_THROW(xmit_fd_error, "recv_fd: " << std::strerror(eno));
OPENVPN_THROW(xmit_fd_error, "recv_fd: " << strerror_str(eno));
}
else if (status == 0)
OPENVPN_THROW(xmit_fd_error, "recv_fd: eof");
@ -130,7 +131,7 @@ namespace openvpn {
if (status < 0)
{
const int eno = errno;
OPENVPN_THROW(xmit_fd_error, "poll_wait: poll failed: " << std::strerror(eno));
OPENVPN_THROW(xmit_fd_error, "poll_wait: poll failed: " << strerror_str(eno));
}
else if (status == 0)
OPENVPN_THROW(xmit_fd_error, "poll_wait: poll timeout");