From a28f9e03be4a91e1a33ce3886fe2182c8e859327 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 8 Apr 1999 04:17:32 +0000 Subject: [PATCH] More errno handling changes for FreeBSD LinuxThreads. --- servers/slapd/back-bdb2/porter.c | 10 +++++----- servers/slapd/back-bdb2/txn.c | 6 ++++-- servers/slapd/back-ldbm/dbcache.c | 5 +++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/servers/slapd/back-bdb2/porter.c b/servers/slapd/back-bdb2/porter.c index 39d3809d36..26e3610773 100644 --- a/servers/slapd/back-bdb2/porter.c +++ b/servers/slapd/back-bdb2/porter.c @@ -61,11 +61,11 @@ bdb2i_enter_backend_rw( DB_LOCK *lock, int writer ) writer ? "write" : "read", 0, 0 ); break; - default: + default: + ret = errno; Debug( LDAP_DEBUG_ANY, "bdb2i_enter_backend() -- %s lock returned ERROR: %s\n", - writer ? "write" : "read", strerror( errno ), 0 ); - ret = errno; + writer ? "write" : "read", strerror( ret ), 0 ); break; } @@ -130,10 +130,10 @@ bdb2i_leave_backend_rw( DB_LOCK lock, int writer ) break; default: + ret_lock = errno; Debug( LDAP_DEBUG_ANY, "bdb2i_leave_backend() -- %s lock returned ERROR: %s\n", - writer ? "write" : "read", strerror( errno ), 0 ); - ret_lock = errno; + writer ? "write" : "read", strerror( ret_lock ), 0 ); break; } diff --git a/servers/slapd/back-bdb2/txn.c b/servers/slapd/back-bdb2/txn.c index 5b53850595..7010a3a11a 100644 --- a/servers/slapd/back-bdb2/txn.c +++ b/servers/slapd/back-bdb2/txn.c @@ -316,10 +316,11 @@ bdb2i_check_additional_attr_index( struct ldbminfo *li ) struct dirent *file; if ( ( datadir = opendir( li->li_directory ) ) == NULL ) { + int err = errno; Debug( LDAP_DEBUG_ANY, "bdb2i_check_additional_attr_index(): ERROR while opening datadir: %s\n", - strerror( errno ), 0, 0 ); + strerror( err ), 0, 0 ); return( 1 ); } @@ -689,8 +690,9 @@ bdb2i_start_transction( DB_TXNMGR *txmgr ) txn_do_abort = 0; if (( rc = txn_begin( txmgr, NULL, &txnid )) != 0 ) { + int err = errno; Debug( LDAP_DEBUG_ANY, "bdb2i_start_transction failed: %d: errno=%s\n", - rc, strerror( errno ), 0 ); + rc, strerror( err ), 0 ); if ( txnid != NULL ) (void) txn_abort( txnid ); diff --git a/servers/slapd/back-ldbm/dbcache.c b/servers/slapd/back-ldbm/dbcache.c index b068612fe3..3da8ed4226 100644 --- a/servers/slapd/back-ldbm/dbcache.c +++ b/servers/slapd/back-ldbm/dbcache.c @@ -92,10 +92,11 @@ ldbm_cache_open( if ( (li->li_dbcache[i].dbc_db = ldbm_open( buf, flags, li->li_mode, li->li_dbcachesize )) == NULL ) { + int err = errno; Debug( LDAP_DEBUG_TRACE, "<= ldbm_cache_open NULL \"%s\" errno %d reason \"%s\")\n", - buf, errno, errno > -1 && errno < sys_nerr ? - sys_errlist[errno] : "unknown" ); + buf, err, err > -1 && err < sys_nerr ? + sys_errlist[err] : "unknown" ); ldap_pvt_thread_mutex_unlock( &li->li_dbcache_mutex ); return( NULL ); } -- 2.39.5