fix rb_w32_strerror when errno < 0

change SystemCallError.new(-1) message on Windows

(Bug #21083)
https://bugs.ruby-lang.org/issues/21083
This commit is contained in:
YO4 2025-01-22 18:30:08 +09:00 committed by Nobuyoshi Nakada
parent c717dbdc81
commit 9c71b5901c
Notes: git 2025-03-18 16:29:17 +00:00

View File

@ -2805,11 +2805,11 @@ rb_w32_strerror(int e)
DWORD source = 0;
char *p;
if (e < 0 || e > sys_nerr) {
if (e < 0)
e = GetLastError();
if (e < 0)
strlcpy(buffer, "Unknown Error", sizeof(buffer));
else if (e > sys_nerr) {
#if WSAEWOULDBLOCK != EWOULDBLOCK
else if (e >= EADDRINUSE && e <= EWOULDBLOCK) {
if (e >= EADDRINUSE && e <= EWOULDBLOCK) {
static int s = -1;
int i;
if (s < 0)