]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/error.c
a00b0ace6d508fbd9024c447d29eec73b095b91c
[openldap] / servers / slapd / back-bdb / error.c
1 /* error.c - BDB errcall routine */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 2000-2018 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in the file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16
17 #include "portable.h"
18
19 #include <stdio.h>
20 #include <ac/string.h>
21
22 #include "slap.h"
23 #include "back-bdb.h"
24
25 #if DB_VERSION_FULL < 0x04030000
26 void bdb_errcall( const char *pfx, char * msg )
27 #else
28 void bdb_errcall( const DB_ENV *env, const char *pfx, const char * msg )
29 #endif
30 {
31 #ifdef HAVE_EBCDIC
32         if ( msg[0] > 0x7f )
33                 __etoa( msg );
34 #endif
35         Debug( LDAP_DEBUG_ANY, "bdb(%s): %s\n", pfx, msg, 0 );
36 }
37
38 #if DB_VERSION_FULL >= 0x04030000
39 void bdb_msgcall( const DB_ENV *env, const char *msg )
40 {
41 #ifdef HAVE_EBCDIC
42         if ( msg[0] > 0x7f )
43                 __etoa( msg );
44 #endif
45         Debug( LDAP_DEBUG_TRACE, "bdb: %s\n", msg, 0, 0 );
46 }
47 #endif
48
49 #ifdef HAVE_EBCDIC
50
51 #undef db_strerror
52
53 /* Not re-entrant! */
54 char *ebcdic_dberror( int rc )
55 {
56         static char msg[1024];
57
58         strcpy( msg, db_strerror( rc ) );
59         __etoa( msg );
60         return msg;
61 }
62 #endif