about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>2010-03-10 21:20:46 -0600
committerGraham Barr <gbarr@pobox.com>2010-03-10 21:20:46 -0600
commitfca945224a9bdd7853b1c7b528f1a506426b32de (patch)
tree5ffb05bae6674e9c95f114308a513994fd8fa48e
parent73dc7393a40391c5cae9d398135813a3bc45df47 (diff)
downloadperl-libnet-fca945224a9bdd7853b1c7b528f1a506426b32de.tar.gz
Avoid infinite recursion in rmdir
-rw-r--r--Net/FTP.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/Net/FTP.pm b/Net/FTP.pm
index af73e39..f8fc197 100644
--- a/Net/FTP.pm
+++ b/Net/FTP.pm
@@ -590,6 +590,9 @@ sub rmdir {
   return undef
     unless @filelist;    # failed, it is probably not a directory
 
+  return $ftp->delete($dir)
+    if @filelist == 1 and $dir eq $filelist[0];
+
   # Go thru and delete each file or the directory
   my $file;
   foreach $file (map { m,/, ? $_ : "$dir/$_" } @filelist) {