dir.c: GC guard
* dir.c (do_opendir): prevent intermediate string for transcoding from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
73cce16240
commit
3e2942423e
5
dir.c
5
dir.c
@ -1134,7 +1134,7 @@ do_opendir(const char *path, int flags, rb_encoding *enc)
|
|||||||
{
|
{
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
volatile VALUE tmp;
|
VALUE tmp = 0;
|
||||||
if (enc != rb_usascii_encoding() &&
|
if (enc != rb_usascii_encoding() &&
|
||||||
enc != rb_ascii8bit_encoding() &&
|
enc != rb_ascii8bit_encoding() &&
|
||||||
enc != rb_utf8_encoding()) {
|
enc != rb_utf8_encoding()) {
|
||||||
@ -1146,6 +1146,9 @@ do_opendir(const char *path, int flags, rb_encoding *enc)
|
|||||||
dirp = opendir(path);
|
dirp = opendir(path);
|
||||||
if (dirp == NULL && !to_be_ignored(errno))
|
if (dirp == NULL && !to_be_ignored(errno))
|
||||||
sys_warning(path);
|
sys_warning(path);
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (tmp) rb_str_resize(tmp, 0); /* GC guard */
|
||||||
|
#endif
|
||||||
|
|
||||||
return dirp;
|
return dirp;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user