Fix gcc -O -D_FORTIFY_SOURCE.

This commit is contained in:
Jan Kratochvil
2017-04-02 22:39:23 +02:00
committed by Howard Hinnant
parent 1fd0806757
commit a4eef8e20c

3
tz.cpp
View File

@@ -3134,7 +3134,8 @@ current_zone()
{
std::ostringstream os;
char message[128];
(void)strerror_r(errno, message, 128);
if (strerror_r(errno, message, sizeof(message)) != 0)
message[0] = '\0';
os << "realpath failure: errno = " << errno << "; " << message;
throw std::runtime_error(os.str());
}