зеркало из https://github.com/github/ruby.git
* ext/etc/etc.c (etc_systmpdir): assume system default tmpdir
safe. [ruby-dev:42089] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
e7ab96f6ed
Коммит
9e39c618da
|
@ -1,3 +1,8 @@
|
|||
Fri Sep 10 07:29:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/etc/etc.c (etc_systmpdir): assume system default tmpdir
|
||||
safe. [ruby-dev:42089]
|
||||
|
||||
Fri Sep 10 07:03:23 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/pathname/pathname.c (path_size_p): Pathname#size? translated from
|
||||
|
|
|
@ -584,14 +584,17 @@ etc_sysconfdir(VALUE obj)
|
|||
static VALUE
|
||||
etc_systmpdir(void)
|
||||
{
|
||||
VALUE tmpdir;
|
||||
#ifdef _WIN32
|
||||
WCHAR path[_MAX_PATH];
|
||||
UINT len = rb_w32_system_tmpdir(path, numberof(path));
|
||||
if (!len) return Qnil;
|
||||
return rb_w32_conv_from_wchar(path, rb_filesystem_encoding());
|
||||
tmpdir = rb_w32_conv_from_wchar(path, rb_filesystem_encoding());
|
||||
#else
|
||||
return rb_filesystem_str_new_cstr("/tmp");
|
||||
tmpdir = rb_filesystem_str_new_cstr("/tmp");
|
||||
#endif
|
||||
FL_UNSET(tmpdir, FL_TAINT|FL_UNTRUSTED);
|
||||
return tmpdir;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -30,6 +30,10 @@ class TestTempfile < Test::Unit::TestCase
|
|||
def test_saves_in_dir_tmpdir_by_default
|
||||
t = tempfile("foo")
|
||||
assert_equal Dir.tmpdir, File.dirname(t.path)
|
||||
bug3733 = '[ruby-dev:42089]'
|
||||
assert_nothing_raised(SecurityError, bug3733) {
|
||||
proc {$SAFE = 1; File.expand_path(Dir.tmpdir)}.call
|
||||
}
|
||||
end
|
||||
|
||||
def test_saves_in_given_directory
|
||||
|
|
Загрузка…
Ссылка в новой задаче