
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.894
diff -u -p -r1.894 common.inc
--- includes/common.inc	8 May 2009 12:23:31 -0000	1.894
+++ includes/common.inc	8 May 2009 13:54:00 -0000
@@ -3037,8 +3037,11 @@ function drupal_cron_run() {
   // Allow execution to continue even if the request gets canceled.
   @ignore_user_abort(TRUE);
 
-  // Increase the maximum execution time.
-  @set_time_limit(240);
+  // If the current maximum execution time is below the target, increase it.
+  $allowed_time = 240;
+  if (ini_get('max_execution_time') < $allowed_time) {
+    @set_time_limit($allowed_time);
+  }
 
   // Fetch the cron semaphore
   $semaphore = variable_get('cron_semaphore', FALSE);
