--- /cvs/drupal/contributions/modules/imagecache/imagecache.modules2008/05/30 15:46:591.73
+++ /cvs/drupal/contributions/modules/imagecache/imagecache.modules2008/05/30 20:13:271.74
@@ -1,5 +1,5 @@
 <?php
-// $Id: imagecache.module,v 1.72 2008/05/30 15:44:55 dopry Exp $
+// $Id: imagecache.module,v 1.73 2008/05/30 15:46:59 dopry Exp $
 
 /**
  * @file
@@ -706,15 +706,24 @@
  * @param string $path
  *   A filepath relative to file_directory_path.
  */
-function _imagecache_recursive_delete($dir) {
-  $d = dir($dir);
-  while (($entry = $d->read()) !== false) {
-    if ($entry == '.' || $entry == '..') continue;
-    $path = $dir .'/'. $entry;
-    if (is_file($path)) unlink($path);
-    if (is_dir($path)) _imagecache_recursive_delete($path);
+function _imagecache_recursive_delete($path) {
+  if (is_file($path) || is_link($path)) {
+    unlink($path);
+  }  
+  elseif (is_dir($path)) {
+    $d = dir($path);
+    while (($entry = $d->read()) !== false) {
+      if ($entry == '.' || $entry == '..') continue;
+      $entry_path = $path .'/'. $entry;
+      _imagecache_recursive_delete($entry_path);
+    }
+    rmdir($path);
+  }
+  else {
+    watchdog('imagecache', 'Unknown file type(%path) stat: %stat ', 
+              array('%path' => $path,  '%stat' => print_r(stat($path),1)), WATCHDOG_ERROR);
   }
-  rmdir($dir);
+  
 }
 
 /**

