[Fedora-directory-commits] ldapserver/ldap/servers/plugins/replication cl5_clcache.c, 1.7, 1.7.2.1

Nathan Kinder (nkinder) fedora-directory-commits at redhat.com
Thu Jul 10 23:04:11 UTC 2008


Author: nkinder

Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/replication
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv3780/ldap/servers/plugins/replication

Modified Files:
      Tag: Directory_Server_8_0_Branch
	cl5_clcache.c 
Log Message:
Resolves: 442170
Summary: Need to use DB_BUFFER_SMALL instead of ENOMEM with newer BDB versions.



Index: cl5_clcache.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/cl5_clcache.c,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- cl5_clcache.c	10 Nov 2006 23:45:17 -0000	1.7
+++ cl5_clcache.c	10 Jul 2008 23:04:09 -0000	1.7.2.1
@@ -45,6 +45,15 @@
 #include "cl5.h"			/* changelog5Config */
 #include "cl5_clcache.h"
 
+/* newer bdb uses DB_BUFFER_SMALL instead of ENOMEM as the
+   error return if the given buffer in which to load a
+   key or value is too small - if it is not defined, define
+   it here to ENOMEM
+*/
+#ifndef DB_BUFFER_SMALL
+#define DB_BUFFER_SMALL ENOMEM
+#endif
+
 /*
  * Constants for the buffer pool:
  *
@@ -248,7 +257,7 @@
 	else {
 		slapi_log_error ( SLAPI_LOG_FATAL, get_thread_private_agmtname(),
 			"clcache_get_buffer: can't allocate new buffer\n" );
-		rc = ENOMEM;
+		rc = CL5_MEMORY_ERROR;
 	}
 
 	return rc;
@@ -379,7 +388,7 @@
 		 * Continue if the error is no-mem since we don't need to
 		 * load in the key record anyway with DB_SET.
 		 */
-		if ( 0 == rc || ENOMEM == rc )
+		if ( 0 == rc || DB_BUFFER_SMALL == rc )
 			rc = clcache_cursor_get ( cursor, buf, flag );
 
 	}
@@ -852,7 +861,7 @@
 
 	if ( NULL == bl ) {
 		if ( NULL == ( bl = clcache_new_busy_list ()) ) {
-			rc = ENOMEM;
+			rc = CL5_MEMORY_ERROR;
 		}
 		else {
 			PR_RWLock_Wlock ( _pool->pl_lock );
@@ -898,7 +907,7 @@
 						 & buf->buf_key,
 						 & buf->buf_data,
 						 buf->buf_load_flag | flag );
-	if ( ENOMEM == rc ) {
+	if ( DB_BUFFER_SMALL == rc ) {
 		/*
 		 * The record takes more space than the current size of the
 		 * buffer. Fortunately, buf->buf_data.size has been set by
@@ -923,7 +932,7 @@
 					"clcache_cursor_get: invalid parameter\n" );
 			break;
 
-		case ENOMEM:
+		case DB_BUFFER_SMALL:
 			slapi_log_error ( SLAPI_LOG_FATAL, buf->buf_agmt_name,
 					"clcache_cursor_get: can't allocate %u bytes\n", buf->buf_data.ulen );
 			break;




More information about the Fedora-directory-commits mailing list