X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslurpd%2Freplog.c;h=e4bf325747399b4f197971bcfafa5a8619d183bc;hb=59d4b38a7c9247d13bbff43c73c253929e348fdf;hp=f43965b8e7687d74569f9c66381d6efe07f0fa25;hpb=3d491808a8d12428eae124e73c49876befef3286;p=openldap diff --git a/servers/slurpd/replog.c b/servers/slurpd/replog.c index f43965b8e7..e4bf325747 100644 --- a/servers/slurpd/replog.c +++ b/servers/slurpd/replog.c @@ -1,10 +1,18 @@ /* $OpenLDAP$ */ -/* - * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved. - * COPYING RESTRICTIONS APPLY, see COPYRIGHT file +/* This work is part of OpenLDAP Software . + * + * Copyright 1998-2007 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 + * . */ -/* - * Copyright (c) 1996 Regents of the University of Michigan. +/* Portions Copyright (c) 1996 Regents of the University of Michigan. * All rights reserved. * * Redistribution and use in source and binary forms are permitted @@ -14,6 +22,10 @@ * 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). + */ /* @@ -58,14 +70,9 @@ copy_replog( static char rbuf[ 1024 ]; char *p; -#ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ARGS, "copy_replog: " - "copy replog \"%s\" to \"%s\"\n", src, dst )); -#else Debug( LDAP_DEBUG_ARGS, "copy replog \"%s\" to \"%s\"\n", src, dst, 0 ); -#endif /* * Make sure the destination directory is writable. If not, exit @@ -78,15 +85,9 @@ copy_replog( *p = '\0'; } if ( access( buf, W_OK ) < 0 ) { -#ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ERR, "copy_replog: " - "Error: (%ld): Directory %s is not writable\n", - (long) getpid(), buf )); -#else Debug( LDAP_DEBUG_ANY, "Error: copy_replog (%ld): Directory %s is not writable\n", (long) getpid(), buf, 0 ); -#endif return( -1 ); } strcpy( buf, dst ); @@ -96,45 +97,27 @@ copy_replog( *p = '\0'; } if ( access( buf, W_OK ) < 0 ) { -#ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ERR, "copy_replog: " - "Error: (%ld): Directory %s is not writable\n", - (long) getpid(), buf )); -#else Debug( LDAP_DEBUG_ANY, "Error: copy_replog (%ld): Directory %s is not writable\n", (long) getpid(), buf, 0 ); -#endif return( -1 ); } /* lock src */ rfp = lock_fopen( src, "r", &lfp ); if ( rfp == NULL ) { -#ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ERR, "copy_replog: " - "Error: Can't lock replog \"%s\" for read: %s\n", - src, sys_errlist[ errno ] )); -#else Debug( LDAP_DEBUG_ANY, "Error: copy_replog: Can't lock replog \"%s\" for read: %s\n", src, sys_errlist[ errno ], 0 ); -#endif return( 1 ); } /* lock dst */ dfp = lock_fopen( dst, "a", &dlfp ); if ( dfp == NULL ) { -#ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ERR, "copy_replog: " - "Error: Can't lock replog \"%s\" for write: %s\n", - src, sys_errlist[ errno ] )); -#else - Debug( LDAP_DEBUG_ANY, - "Error: copy_replog: Can't lock replog \"%s\" for write: %s\n", - src, sys_errlist[ errno ], 0 ); -#endif + 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 ); } @@ -142,7 +125,7 @@ copy_replog( /* * 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 */ @@ -152,24 +135,14 @@ copy_replog( } if ( lock_fclose( dfp, dlfp ) == EOF ) { -#ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ERR, "copy_replog: " - "Error: Error closing \"%s\"\n", src )); -#else - Debug( LDAP_DEBUG_ANY, - "Error: copy_replog: Error closing \"%s\"\n", - src, 0, 0 ); -#endif + Debug( LDAP_DEBUG_ANY, + "Error: copy_replog: Error closing \"%s\"\n", + dst, 0, 0 ); } if ( lock_fclose( rfp, lfp ) == EOF ) { -#ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ERR, "copy_replog: " - "Error: Error closing \"%s\"\n", src )); -#else Debug( LDAP_DEBUG_ANY, "Error: copy_replog: Error closing \"%s\"\n", src, 0, 0 ); -#endif } return( rc ); }