summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-01 02:34:30 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-01 02:34:30 +0000
commitee39e2578a2b9c24d4080390a8da90f8a7741dca (patch)
treea85963263983c90a7f40dbe507a3d924f0e9375d /win32
parent049a4ef3906843ac6d16e12954dcf1fdce50cfef (diff)
* win32/win32.c (rb_w32_getcwd): set errno if not set.
fixed [ruby-list:42346] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c
index b817cdf4ea..c044efdd22 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2611,15 +2611,22 @@ rb_w32_getcwd(char *buffer, int size)
{
int length;
char *bp;
+ int save_errno = errno;
#undef getcwd
+ errno = 0;
+ SetLastError(0);
if (getcwd(buffer, size) == NULL) {
+ if (!errno)
+ errno = GetLastError() ? map_errno(GetLastError()) : ERANGE;
return NULL;
}
length = strlen(buffer);
if (length >= size) {
+ errno = ERANGE;
return NULL;
}
+ errno = save_errno;
for (bp = buffer; *bp != '\0'; bp = CharNext(bp)) {
if (*bp == '\\') {