From 8ff5c375ca4dcea0841d004e3e58c19ef19545de Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sat, 16 Mar 2024 20:58:25 -0400 Subject: [PATCH] Fix strerror_r() usage for *BSD OS's --- src/strict_fstream.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/strict_fstream.hpp b/src/strict_fstream.hpp index 7cc2926..37c86be 100755 --- a/src/strict_fstream.hpp +++ b/src/strict_fstream.hpp @@ -64,7 +64,9 @@ static std::string strerror() } else { return "Unknown error (" + std::to_string(err_num) + ")"; } -#elif ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE) || defined(__APPLE__) || defined(__MUSL__) || defined(__FreeBSD__) +#elif ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE) || \ + defined(__APPLE__) || defined(__MUSL__) || defined(__FreeBSD__) || \ + defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) // XSI-compliant strerror_r() const int err_num = errno; // See above if (strerror_r(err_num, buff.data(), buff.size()) == 0) {