summaryrefslogtreecommitdiffstats
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
commit84d8328015538710b773c2c6c71c946194be434f (patch)
tree8861089be926486d951841d0c892014441a0cf79
parent1d5e4deaa240636d8eea04f7539db5daddfe3708 (diff)
downloadruby-84d8328015538710b773c2c6c71c946194be434f.tar.gz
ruby-84d8328015538710b773c2c6c71c946194be434f.tar.xz
ruby-84d8328015538710b773c2c6c71c946194be434f.zip
* win32/win32.c (rb_w32_getcwd): set errno if not set.
fixed [ruby-list:42346] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--win32/win32.c7
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d2abb9aaa..c8a983f5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jun 1 11:33:32 2006 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_getcwd): set errno if not set.
+ fixed [ruby-list:42346]
+
Sat May 27 22:46:38 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (proc_invoke): save and restore block in the current frame.
diff --git a/win32/win32.c b/win32/win32.c
index 9e448564f..999ff6804 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2935,18 +2935,25 @@ rb_w32_getcwd(char *buffer, int size)
{
int length;
char *bp;
+ int save_errno = errno;
#undef getcwd
#ifndef __BORLANDC__
#define getcwd _getcwd
#endif
+ 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 == '\\') {