Index: path.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.module,v
retrieving revision 1.105.2.2
diff -u -p -r1.105.2.2 path.module
--- path.module	11 Feb 2008 05:11:58 -0000	1.105.2.2
+++ path.module	30 Oct 2008 18:21:44 -0000
@@ -130,11 +130,9 @@ function path_admin_delete($pid = 0) {
 function path_set_alias($path = NULL, $alias = NULL, $pid = NULL) {
   if ($path && !$alias) {
     db_query("DELETE FROM {url_alias} WHERE src = '%s'", $path);
-    drupal_clear_path_cache();
   }
   else if (!$path && $alias) {
     db_query("DELETE FROM {url_alias} WHERE dst = '%s'", $alias);
-    drupal_clear_path_cache();
   }
   else if ($path && $alias) {
     $path = urldecode($path);
@@ -143,30 +141,27 @@ function path_set_alias($path = NULL, $a
     $alias_count = db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s'", $alias));
 
     // We have an insert:
-    if ($path_count == 0 && $alias_count == 0) {
+    if (!$path_count && !$alias_count) {
       db_query("INSERT INTO {url_alias} (src, dst) VALUES ('%s', '%s')", $path, $alias);
-      drupal_clear_path_cache();
     }
-    else if ($path_count >= 1 && $alias_count == 0) {
+    else if ($path_count && !$alias_count) {
       if ($pid) {
         db_query("UPDATE {url_alias} SET dst = '%s', src = '%s' WHERE pid = %d", $alias, $path, $pid);
       }
       else {
         db_query("INSERT INTO {url_alias} (src, dst) VALUES ('%s', '%s')", $path, $alias);
       }
-      drupal_clear_path_cache();
     }
-    else if ($path_count == 0 && $alias_count == 1) {
+    else if (!$path_count && $alias_count) {
       db_query("UPDATE {url_alias} SET src = '%s' WHERE dst = '%s'", $path, $alias);
-      drupal_clear_path_cache();
     }
-    else if ($path_count == 1 && $alias_count == 1) {
+    else if ($path_count && $alias_count) {
       // This will delete the path that alias was originally pointing to:
       path_set_alias(NULL, $alias);
-      path_set_alias($path);
       path_set_alias($path, $alias);
     }
   }
+  drupal_clear_path_cache();
 }
 
 /**
