/* $OpenLDAP$ */
-/*
- * Copyright (c) 1996 Regents of the University of Michigan.
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2005 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* Portions Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*/
+/* ACKNOWLEDGEMENTS:
+ * This work was originally developed by the University of Michigan
+ * (as part of U-MICH LDAP).
+ */
/*
#include <stdio.h>
+#include <ac/stdlib.h>
#include <ac/errno.h>
#include <ac/param.h>
#include <ac/string.h>
* with a fatal error.
*/
strcpy( buf, src );
- if (( p = strrchr( buf, '/' )) == NULL ) {
+ if (( p = strrchr( buf, LDAP_DIRSEP[0] )) == NULL ) {
strcpy( buf, "." );
} else {
*p = '\0';
return( -1 );
}
strcpy( buf, dst );
- if (( p = strrchr( buf, '/' )) == NULL ) {
+ if (( p = strrchr( buf, LDAP_DIRSEP[0] )) == NULL ) {
strcpy( buf, "." );
} else {
*p = '\0';
/* lock dst */
dfp = lock_fopen( dst, "a", &dlfp );
if ( dfp == NULL ) {
- Debug( LDAP_DEBUG_ANY,
- "Error: copy_replog: Can't lock replog \"%s\" for write: %s\n",
- src, sys_errlist[ errno ], 0 );
+ Debug( LDAP_DEBUG_ANY,
+ "Error: copy_replog: Can't lock replog \"%s\" for write: %s\n",
+ dst, sys_errlist[ errno ], 0 );
lock_fclose( rfp, lfp );
return( 1 );
}
/*
* Make our own private copy of the replication log.
*/
- while (( p = fgets( rbuf, sizeof( buf ), rfp )) != NULL ) {
+ while (( p = fgets( rbuf, sizeof( rbuf ), rfp )) != NULL ) {
fputs( rbuf, dfp );
}
/* Only truncate the source file if we're not in one-shot mode */
}
if ( lock_fclose( dfp, dlfp ) == EOF ) {
- Debug( LDAP_DEBUG_ANY,
- "Error: copy_replog: Error closing \"%s\"\n",
- src, 0, 0 );
+ Debug( LDAP_DEBUG_ANY,
+ "Error: copy_replog: Error closing \"%s\"\n",
+ dst, 0, 0 );
}
if ( lock_fclose( rfp, lfp ) == EOF ) {
Debug( LDAP_DEBUG_ANY,