mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* dir.c (dir_check): moved other checks from GetDIR.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
22ec8c664a
commit
252168ed1b
2 changed files with 9 additions and 7 deletions
|
@ -1,4 +1,6 @@
|
||||||
Wed Nov 4 08:21:00 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Nov 4 08:26:00 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* dir.c (dir_check): moved other checks from GetDIR.
|
||||||
|
|
||||||
* dir.c (GetDIR): fixed a variable name.
|
* dir.c (GetDIR): fixed a variable name.
|
||||||
|
|
||||||
|
|
12
dir.c
12
dir.c
|
@ -447,19 +447,19 @@ dir_closed(void)
|
||||||
rb_raise(rb_eIOError, "closed directory");
|
rb_raise(rb_eIOError, "closed directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct dir_data *
|
||||||
dir_check(VALUE dir)
|
dir_check(VALUE dir)
|
||||||
{
|
{
|
||||||
|
struct dir_data *dirp;
|
||||||
if (!OBJ_UNTRUSTED(dir) && rb_safe_level() >= 4)
|
if (!OBJ_UNTRUSTED(dir) && rb_safe_level() >= 4)
|
||||||
rb_raise(rb_eSecurityError, "Insecure: operation on trusted Dir");
|
rb_raise(rb_eSecurityError, "Insecure: operation on trusted Dir");
|
||||||
rb_check_frozen(dir);
|
rb_check_frozen(dir);
|
||||||
|
dirp = rb_check_typeddata(dir, &dir_data_type);
|
||||||
|
if (!dirp->dir) dir_closed();
|
||||||
|
return dirp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GetDIR(obj, dirp) do {\
|
#define GetDIR(obj, dirp) (dirp = dir_check(obj))
|
||||||
dir_check(obj); \
|
|
||||||
TypedData_Get_Struct(obj, struct dir_data, &dir_data_type, dirp); \
|
|
||||||
if (dirp->dir == NULL) dir_closed();\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue