From f41e9c805cf5112bc0a84770e1c860c912d6d61a Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 10 Jul 2005 15:17:35 +0000 Subject: [PATCH] * lib/pathname.rb (Pathname#unlink): try Dir.unlink first to avoid unlink a directory by root. cf. [ruby-dev:26237] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ lib/pathname.rb | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f555b70bc3..b85c2508d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Jul 10 23:58:04 2005 Tanaka Akira + + * lib/pathname.rb (Pathname#unlink): try Dir.unlink first to + avoid unlink a directory by root. + cf. [ruby-dev:26237] + Sun Jul 10 12:47:01 2005 Nobuyoshi Nakada * lib/debug.rb (debug_command): added a deficient format specifier. diff --git a/lib/pathname.rb b/lib/pathname.rb index 9a08fa39c2..fd7fa508b8 100644 --- a/lib/pathname.rb +++ b/lib/pathname.rb @@ -869,9 +869,9 @@ class Pathname # * mixed * # Dir.unlink as necessary. def unlink() begin - File.unlink @path - rescue SystemCallError Dir.unlink @path + rescue Errno::ENOTDIR + File.unlink @path end end alias delete unlink