summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/pathname/lib/pathname.rb3
-rw-r--r--ext/pathname/pathname.c10
2 files changed, 10 insertions, 3 deletions
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 <tt>File.lchown</tt>.
- def lchown(owner, group) File.lchown(owner, group, @path) end
-
# See <tt>File.fnmatch</tt>. 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
@@ -287,6 +287,15 @@ path_chown(VALUE self, VALUE owner, VALUE group)
}
/*
+ * See <tt>File.lchown</tt>.
+ */
+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
*
* Pathname represents a pathname which locates a file in a filesystem.
@@ -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);
}