* 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
|
@ -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.
|
||||
|
||||
|
|
12
dir.c
12
dir.c
|
@ -447,19 +447,19 @@ dir_closed(void)
|
|||
rb_raise(rb_eIOError, "closed directory");
|
||||
}
|
||||
|
||||
static void
|
||||
static struct dir_data *
|
||||
dir_check(VALUE dir)
|
||||
{
|
||||
struct dir_data *dirp;
|
||||
if (!OBJ_UNTRUSTED(dir) && rb_safe_level() >= 4)
|
||||
rb_raise(rb_eSecurityError, "Insecure: operation on trusted 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 {\
|
||||
dir_check(obj); \
|
||||
TypedData_Get_Struct(obj, struct dir_data, &dir_data_type, dirp); \
|
||||
if (dirp->dir == NULL) dir_closed();\
|
||||
} while (0)
|
||||
#define GetDIR(obj, dirp) (dirp = dir_check(obj))
|
||||
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue