* 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/trunk@10199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e0337774ed
commit
f85ebe0963
@ -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>
|
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.
|
* eval.c (proc_invoke): save and restore block in the current frame.
|
||||||
|
@ -2935,18 +2935,25 @@ rb_w32_getcwd(char *buffer, int size)
|
|||||||
{
|
{
|
||||||
int length;
|
int length;
|
||||||
char *bp;
|
char *bp;
|
||||||
|
int save_errno = errno;
|
||||||
|
|
||||||
#undef getcwd
|
#undef getcwd
|
||||||
#ifndef __BORLANDC__
|
#ifndef __BORLANDC__
|
||||||
#define getcwd _getcwd
|
#define getcwd _getcwd
|
||||||
#endif
|
#endif
|
||||||
|
errno = 0;
|
||||||
|
SetLastError(0);
|
||||||
if (getcwd(buffer, size) == NULL) {
|
if (getcwd(buffer, size) == NULL) {
|
||||||
|
if (!errno)
|
||||||
|
errno = GetLastError() ? map_errno(GetLastError()) : ERANGE;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
length = strlen(buffer);
|
length = strlen(buffer);
|
||||||
if (length >= size) {
|
if (length >= size) {
|
||||||
|
errno = ERANGE;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
errno = save_errno;
|
||||||
|
|
||||||
for (bp = buffer; *bp != '\0'; bp = CharNext(bp)) {
|
for (bp = buffer; *bp != '\0'; bp = CharNext(bp)) {
|
||||||
if (*bp == '\\') {
|
if (*bp == '\\') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user