]> git.sur5r.net Git - openldap/commitdiff
ITS#8127 fix ftello for Win32
authorHoward Chu <hyc@openldap.org>
Thu, 7 May 2015 09:45:28 +0000 (10:45 +0100)
committerHoward Chu <hyc@openldap.org>
Thu, 7 May 2015 09:48:42 +0000 (10:48 +0100)
servers/slapd/slapadd.c

index 8cfdebdaa8006ebb63a1143fcbd960358e56bc85..d89d2eff2aeb8543d47f25f0d21c50bf08afce59 100644 (file)
 
 #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 ];