fix(libc): keep the caller errno when the Windows tm_year range overflows
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
b1cf01464a
commit
a37ee5ff2c
|
|
@ -479,7 +479,7 @@ GuestTm* APS5_VABI localtime_s_nid_postfix(const int64_t* timer, GuestTm* result
|
|||
}
|
||||
const std::int64_t year = host.tm_year + cycles * CALENDAR_CYCLE_YEARS;
|
||||
if (year < std::numeric_limits<int>::min() || year > std::numeric_limits<int>::max()) {
|
||||
errno = EINVAL;
|
||||
errno = callerError;
|
||||
return nullptr;
|
||||
}
|
||||
host.tm_year = static_cast<int>(year);
|
||||
|
|
|
|||
Loading…
Reference in New Issue