Index: modules/update/update.manager.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.manager.inc,v
retrieving revision 1.25
diff -u -r1.25 update.manager.inc
--- modules/update/update.manager.inc	18 Nov 2010 05:35:39 -0000	1.25
+++ modules/update/update.manager.inc	20 Nov 2010 09:45:12 -0000
@@ -708,8 +708,8 @@
     mkdir($cache_directory);
   }
 
-  if (!file_exists($local)) {
-    return system_retrieve_file($url, $local);
+  if (!file_exists($local) || update_delete_file_if_stale($local)) {
+    return system_retrieve_file($url, $local, FALSE, FILE_EXISTS_REPLACE);
   }
   else {
     return $local;
Index: modules/update/update.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.module,v
retrieving revision 1.70
diff -u -r1.70 update.module
--- modules/update/update.module	6 Oct 2010 13:36:30 -0000	1.70
+++ modules/update/update.module	20 Nov 2010 09:45:13 -0000
@@ -301,6 +301,9 @@
     // missing data, and if so, try to fetch the data.
     update_get_available(TRUE);
   }
+
+  // Clear garbage from disk.
+  update_clear_update_cache();
 }
 
 /**
@@ -784,5 +787,38 @@
 }
 
 /**
+ * Clear the temporary files and directories based on file age from disk.
+ */
+function update_clear_update_cache() {
+  // List of update module cache directories.
+  $directories = array(
+    'temporary://update-cache',
+    'temporary://update-extraction',
+  );
+
+  // Search for files and directories in base folder only without recursion.
+  foreach ($directories as $directory) {
+    file_scan_directory($directory, '/.*/', array('callback' => 'update_delete_file_if_stale', 'recurse' => FALSE));
+  }
+}
+
+/**
+ * Delete stale files and directories older than 6 hours from disk.
+ *
+ * @param $path
+ *   A string containing a file path or (streamwrapper) URI.
+ */
+function update_delete_file_if_stale($path) {
+  // Note: we need to use the ctime, not the mtime (modification time) since
+  // many (all?) tar implementations will go out of their way to set the mtime
+  // on the files it creates to the timestamps recorded in the tarball.
+  // We want to see the last time the file was changed on disk, which is left
+  // alone by tar and correctly set to the time the .info file was unpacked.
+  if (file_exists($path) && REQUEST_TIME - filectime($path) > DRUPAL_MAXIMUM_TEMP_FILE_AGE) {
+    file_unmanaged_delete_recursive($path);
+  }
+}
+
+/**
  * @} End of "defgroup update_status_cache".
  */
