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

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Mon Jun 23 18:32:14 UTC 2008


Author: rmeggins

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

Modified Files:
	cl5_clcache.c 
Log Message:
Resolves: bug 442170
Bug Description: "DB_BUFFER_SMALL: User memory too small for return value" error when importing LDIF with replication active
Reviewed by: nkinder (Thanks!)
Fix Description: BDB 4.3 does not use ENOMEM if the given buffer is too small - it uses DB_BUFFER_SMALL.  This fix allows us to use DB_BUFFER_SMALL in BDB 4.2 and earlier too.  I also cleaned up some of the cl5 api return codes to return an appropriate error code to the higher levels rather than pass the ENOMEM up.
Platforms tested: RHEL5
Flag Day: no
Doc impact: no



Index: cl5_clcache.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/cl5_clcache.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cl5_clcache.c	10 Nov 2006 23:45:17 -0000	1.7
+++ cl5_clcache.c	23 Jun 2008 18:32:11 -0000	1.8
@@ -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