Index: includes/update.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/update.inc,v
retrieving revision 1.41
diff -u -p -r1.41 update.inc
--- includes/update.inc	31 Mar 2010 19:10:39 -0000	1.41
+++ includes/update.inc	2 Apr 2010 00:57:20 -0000
@@ -344,37 +344,40 @@ function update_fix_d7_requirements() {
       ),
     );
     db_create_table('role_permission', $schema['role_permission']);
-
-    // Add the {semaphore} table in case menu_rebuild() gets called during
-    // an update.
-    $schema['semaphore'] = array(
-      'description' => 'Table for holding semaphores, locks, flags, etc. that cannot be stored as Drupal variables since they must not be cached.',
-      'fields' => array(
-        'name' => array(
-          'description' => 'Primary Key: Unique name.',
-          'type' => 'varchar',
-          'length' => 255,
-          'not null' => TRUE,
-          'default' => ''
-        ),
-        'value' => array(
-          'description' => 'A value for the semaphore.',
-          'type' => 'varchar',
-          'length' => 255,
-          'not null' => TRUE,
-          'default' => ''
-        ),
-        'expire' => array(
-          'description' => 'A Unix timestamp with microseconds indicating when the semaphore should expire.',
-          'type' => 'float',
-          'size' => 'big',
-          'not null' => TRUE
-        ),
-      ),
-      'indexes' => array('value' => array('value')),
-      'primary key' => array('name'),
-    );
-    db_create_table('semaphore', $schema['semaphore']);
+    
+    // Because we support upgrades from any version of Drupal 6, the {semaphore}
+    // table may or may not exist, so check before trying to create it.
+    if (!db_table_exists('semaphore')) {
+      // Add the {semaphore} table in case menu_rebuild() gets called during
+      // an update.
+      $schema['semaphore'] = array(
+        'description' => 'Table for holding semaphores, locks, flags, etc. that cannot be stored as Drupal variables since they must not be cached.',
+        'fields' => array(
+          'name' => array(
+            'description' => 'Primary Key: Unique name.',
+            'type' => 'varchar',
+            'length' => 255,
+            'not null' => TRUE,
+            'default' => ''
+          ),
+          'value' => array(
+            'description' => 'A value for the semaphore.',
+            'type' => 'varchar',
+            'length' => 255,
+            'not null' => TRUE,
+            'default' => ''
+          ),
+          'expire' => array(
+            'description' => 'A Unix timestamp with microseconds indicating when the semaphore should expire.',
+            'type' => 'float',
+            'size' => 'big',
+            'not null' => TRUE
+          ),
+        ),
+        'indexes' => array('value' => array('value')),
+        'primary key' => array('name'),
+      );
+    }
 
     // Add registry tables since these are required during an update.
     $schema['registry'] = array(
