]> git.sur5r.net Git - openldap/blobdiff - libraries/liblber/bprint.c
Move schema needed by slapd to core.schema so that only one file
[openldap] / libraries / liblber / bprint.c
index 5c615a129175015084aaf5d9ba5500b5a134f1af..ec2949eb71fb06026311384606c9fb9662662a75 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
 
 #include "lber-int.h"
 
+/*
+ * We don't just set ber_pvt_err_file to stderr here, because in NT,
+ * stderr is a symbol imported from a DLL. As such, the compiler
+ * doesn't recognize the symbol as having a constant address. Thus
+ * we set ber_pvt_err_file to stderr later, when it first gets
+ * referenced.
+ */
+FILE *ber_pvt_err_file;
+
 /*
  * ber errno
  */
@@ -38,8 +47,19 @@ ber_error_print( char *data )
 {
        assert( data != NULL );
 
+       if (!ber_pvt_err_file)
+           ber_pvt_err_file = stderr;
+
+       fputs( data, ber_pvt_err_file );
+
+       /* Print to both streams */
+       if (ber_pvt_err_file != stderr)
+       {
        fputs( data, stderr );
        fflush( stderr );
+       }
+
+       fflush( ber_pvt_err_file );
 }
 
 BER_LOG_PRINT_FN ber_pvt_log_print = ber_error_print;