aboutsummaryrefslogtreecommitdiffstats
path: root/win32/win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c
index d9ab68a902..a5665cf008 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1759,9 +1759,9 @@ rb_w32_strerror(int e)
buffer[sizeof(buffer) - 1] = 0;
}
- for (p = buffer + strlen(buffer) - 1; buffer <= p; p--) {
- if (*p != '\r' && *p != '\n') break;
- *p = 0;
+ p = buffer;
+ while ((p = strpbrk(p, "\r\n")) != NULL) {
+ memmove(p, p + 1, strlen(p));
}
return buffer;
}