summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-10-31 08:37:47 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-10-31 08:37:47 +0000
commitc90b1ecaf81868ab64b014401ea75eb45da2c5d0 (patch)
tree8aa0738f21319dc82e0403a4f065f831a907ebcc /win32
parent5f4d324d3b7f9f50c7c1eb2ec6d2b546e4466f0b (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 9142c4d..a2b256d 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1724,26 +1724,30 @@ myfdclose(FILE *fp)
#undef strerror
-char *
-mystrerror(int e)
+char *
+mystrerror(int e)
{
static char buffer[512];
#if !defined __MINGW32__
extern int sys_nerr;
#endif
DWORD source = 0;
+ char *p;
if (e < 0 || e > sys_nerr) {
if (e < 0)
e = GetLastError();
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, &source, e, 0,
buffer, 512, NULL) == 0) {
- strcpy (buffer, "Unknown Error");
+ strcpy(buffer, "Unknown Error");
+ }
+ for (p = buffer + strlen(buffer) - 1; buffer <= p; p--) {
+ if (*p != '\r' && *p != '\n') break;
+ *p = 0;
}
return buffer;
}
return strerror(e);
-
}
//