From 49cb5a78a14584de5932637d16fbd4ee0733d9d3 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 7 Aug 2010 09:21:37 +0000 Subject: * ext/pathname/pathname.c (path_lchown): Pathname#lchown translated from pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/pathname/lib/pathname.rb | 3 --- ext/pathname/pathname.c | 10 ++++++++++ test/pathname/test_pathname.rb | 1 - 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f096ad72a1..3d55c4670d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Aug 7 18:20:41 2010 Tanaka Akira + + * ext/pathname/pathname.c (path_lchown): Pathname#lchown translated + from pathname.rb. + Sat Aug 7 17:49:10 2010 Nobuyoshi Nakada * include/ruby/missing.h: moved BROKEN_CLOSE replacements from diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb index ad51ed70f5..b3bc42d9a1 100644 --- a/ext/pathname/lib/pathname.rb +++ b/ext/pathname/lib/pathname.rb @@ -512,9 +512,6 @@ end class Pathname # * File * - # See File.lchown. - def lchown(owner, group) File.lchown(owner, group, @path) end - # See File.fnmatch. Return +true+ if the receiver matches the given # pattern. def fnmatch(pattern, *args) File.fnmatch(pattern, @path, *args) end diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index 5dc846a2ed..e317e85618 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -286,6 +286,15 @@ path_chown(VALUE self, VALUE owner, VALUE group) return rb_funcall(rb_cFile, rb_intern("chown"), 3, owner, group, get_strpath(self)); } +/* + * See File.lchown. + */ +static VALUE +path_lchown(VALUE self, VALUE owner, VALUE group) +{ + return rb_funcall(rb_cFile, rb_intern("lchown"), 3, owner, group, get_strpath(self)); +} + /* * == Pathname * @@ -492,4 +501,5 @@ Init_pathname() rb_define_method(rb_cPathname, "chmod", path_chmod, 1); rb_define_method(rb_cPathname, "lchmod", path_lchmod, 1); rb_define_method(rb_cPathname, "chown", path_chown, 2); + rb_define_method(rb_cPathname, "lchown", path_lchown, 2); } diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb index eb42aab122..c34d61f408 100644 --- a/test/pathname/test_pathname.rb +++ b/test/pathname/test_pathname.rb @@ -738,7 +738,6 @@ class TestPathname < Test::Unit::TestCase File.symlink("a", "l") path = Pathname("l") old = path.lstat.mode - assert_normal_exit %{ require "pathname"; Pathname("foo").lchmod(nil) } begin path.lchmod(0444) rescue NotImplementedError -- cgit v1.2.3