mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* file.c (file_expand_path): should check if could find user.
[ruby-core:31538] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@28795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
209cf1351b
commit
f2c87d5395
3 changed files with 10 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Fri Jul 30 08:33:20 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (file_expand_path): should check if could find user.
|
||||
[ruby-core:31538]
|
||||
|
||||
Fri Jul 30 07:59:53 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* util.c (ruby_add_suffix): fixed a bug returning uninitialized
|
||||
|
|
2
file.c
2
file.c
|
@ -2554,6 +2554,8 @@ file_expand_path(fname, dname, result)
|
|||
strcpy(buf, pwPtr->pw_dir);
|
||||
p = buf + strlen(pwPtr->pw_dir);
|
||||
endpwent();
|
||||
#else
|
||||
rb_raise(rb_eArgError, "can't find user %s", buf);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -353,6 +353,9 @@ class TestFileExhaustive < Test::Unit::TestCase
|
|||
assert_equal(@file, File.expand_path(@file + "."))
|
||||
assert_equal(@file, File.expand_path(@file + "::$DATA"))
|
||||
end
|
||||
assert_kind_of(String, File.expand_path("~"))
|
||||
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha") }
|
||||
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha", "/") }
|
||||
end
|
||||
|
||||
def test_basename
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue