system/Error: fix duplicate strerror() call

Apparently, the std::system_error constructor appends strerror()
already.
This commit is contained in:
Max Kellermann 2015-12-27 06:04:57 +01:00
parent e939d667d9
commit 672e18cac9

View File

@ -111,14 +111,8 @@ static inline std::system_error
FormatErrno(int code, const char *fmt, Args&&... args)
{
char buffer[512];
const auto end = buffer + sizeof(buffer);
size_t length = snprintf(buffer, sizeof(buffer) - 128,
fmt, std::forward<Args>(args)...);
char *p = buffer + length;
*p++ = ':';
*p++ = ' ';
CopyString(p, strerror(code), end - p);
snprintf(buffer, sizeof(buffer),
fmt, std::forward<Args>(args)...);
return MakeErrno(code, buffer);
}