Browse Source

510147 clean up the replication log msg
_cl5DBOpen removes a changelog db if there is no matching replica for the file.
The manner to remove the changelog db file was not good -- not using the API
that Berkeley DB provided, but removing it with NSPR delete function PR_Delete.
This fix replaces PR_Delete with the Berkeley DB API dbremove.

Noriko Hosoi 16 years ago
parent
commit
8da07138e5
1 changed files with 9 additions and 8 deletions
  1. 9 8
      ldap/servers/plugins/replication/cl5_api.c

+ 9 - 8
ldap/servers/plugins/replication/cl5_api.c

@@ -2514,14 +2514,15 @@ static int _cl5DBOpen ()
                 slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, "_cl5DBOpen: "
                 slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, "_cl5DBOpen: "
                           "file %s has no matching replica; removing\n", entry->name);
                           "file %s has no matching replica; removing\n", entry->name);
 
 
-				PR_snprintf(fullpathname, MAXPATHLEN, "%s/%s", s_cl5Desc.dbDir, entry->name);
-                if (PR_Delete(fullpathname) != PR_SUCCESS)	
-	            {
-		            slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, "_cl5DBOpen: "
-                                    "failed to remove (%s) file; NSPR error - %d\n",
-						            entry->name, PR_GetError ());
-
-	            }
+                rc = s_cl5Desc.dbEnv->dbremove(s_cl5Desc.dbEnv,
+                                               0, fullpathname, 0, 0);
+                if (rc != 0)
+                {
+                    slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl,
+                                    "_cl5DBOpen: failed to remove (%s) file; "
+                                    "libdb error - %d (%s)\n",
+                                    fullpathname, rc, db_strerror(rc));
+                }
             }
             }
         }
         }
 	}
 	}