X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fslapadd.c;h=1fcc349def9bb27025c8b63fc9ae7179b31e358a;hb=50d1588b2e1d5204356576666b4f2f34651f8902;hp=951739406248f2884b4b7185415baf63987c5fb0;hpb=afbd74c4de0dd14a7fbdf986c0aad2f0ed6e130a;p=openldap diff --git a/servers/slapd/slapadd.c b/servers/slapd/slapadd.c index 9517394062..1fcc349def 100644 --- a/servers/slapd/slapadd.c +++ b/servers/slapd/slapadd.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2013 The OpenLDAP Foundation. + * Copyright 1998-2017 The OpenLDAP Foundation. * Portions Copyright 1998-2003 Kurt D. Zeilenga. * Portions Copyright 2003 IBM Corporation. * All rights reserved. @@ -40,6 +40,20 @@ #include "slapcommon.h" +#ifdef _WIN32 +# ifdef __WIN64__ +# define ftello(fp) _ftelli64(fp) +# else +/* Ideally we would use _ftelli64 but that was only available + * starting in MSVCR80.DLL. The approach used here is inaccurate + * because returning the underlying file handle's file pointer + * doesn't take the stdio buffer offset into account. But, it + * works with all versions of MSVCRT. + */ +# define ftello(fp) _telli64(fileno(fp)) +# endif +#endif + extern int slap_DN_strict; /* dn.c */ static char csnbuf[ LDAP_PVT_CSNSTR_BUFSIZE ]; @@ -114,7 +128,7 @@ again: if ( enable_meter ) lutil_meter_update( &meter, - ftell( ldiffp->fp ), + ftello( ldiffp->fp ), 0); if( e == NULL ) { @@ -483,7 +497,7 @@ slapadd( int argc, char **argv ) bvtext.bv_val[0] = '\0'; if ( enable_meter ) { - lutil_meter_update( &meter, ftell( ldiffp->fp ), 1); + lutil_meter_update( &meter, ftello( ldiffp->fp ), 1); lutil_meter_close( &meter ); }