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:
Adrià Franch 2026-10-13 14:50:07 +02:00
parent b1cf01464a
commit a37ee5ff2c
1 changed files with 1 additions and 1 deletions

View File

@ -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);