diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | win32/win32.c | 7 |
2 files changed, 12 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Thu Jun 1 11:29:14 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 11:29:46 2006 nobuyoshi nakada <nobu@ruby-lang.org> * ext/extmk.rb (extmake): remove extinit files if no statically linked 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 == '\\') { |