X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslurpd%2Freplog.c;h=6b637db4a3f7ba41046591b69b9a9b59770625e3;hb=fe3b6d00714d551a4c781ee24627e2586d06459f;hp=d13ea4bb813c2f53704eda42cd644b2863576208;hpb=4cc712db5378592205e4113f6e73da9bfd189ecc;p=openldap diff --git a/servers/slurpd/replog.c b/servers/slurpd/replog.c index d13ea4bb81..6b637db4a3 100644 --- a/servers/slurpd/replog.c +++ b/servers/slurpd/replog.c @@ -1,6 +1,18 @@ /* $OpenLDAP$ */ -/* - * Copyright (c) 1996 Regents of the University of Michigan. +/* This work is part of OpenLDAP Software . + * + * Copyright 1998-2006 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 + * . + */ +/* Portions Copyright (c) 1996 Regents of the University of Michigan. * All rights reserved. * * Redistribution and use in source and binary forms are permitted @@ -10,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). + */ /* @@ -20,6 +36,7 @@ #include +#include #include #include #include @@ -62,7 +79,7 @@ copy_replog( * 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'; @@ -74,7 +91,7 @@ copy_replog( return( -1 ); } strcpy( buf, dst ); - if (( p = strrchr( buf, '/' )) == NULL ) { + if (( p = strrchr( buf, LDAP_DIRSEP[0] )) == NULL ) { strcpy( buf, "." ); } else { *p = '\0'; @@ -98,9 +115,9 @@ copy_replog( /* 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 ); } @@ -108,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 */ @@ -118,9 +135,9 @@ copy_replog( } 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,