srctree

Robin Linden parent d6d6bd07 fbb88413
protocol: Use errno instead of an error message in the file_handler test

std::strerror isn't safe to call if any other thread can call it. Wedon't have threads in this test, but displaying the errno is just asinformative, so let's do that.

inlinesplit
protocol/file_handler_test.cpp added: 2, removed: 4, total 0
@@ -10,7 +10,6 @@
#include <fmt/format.h>
 
#include <cerrno>
#include <cstring>
#include <filesystem>
#include <fstream>
#include <iostream>
@@ -36,8 +35,7 @@ public:
 
std::fstream file{location, std::fstream::in | std::fstream::out | std::fstream::trunc};
if (!file) {
std::cerr << "Unable to create file at " << location.generic_string() << " [" << std::strerror(errno)
<< "]\n";
std::cerr << "Unable to create file at " << location.generic_string() << " (" << errno << ")\n";
return std::nullopt;
}