[open-ils-commits] r9734 - trunk/Open-ILS/src/c-apps

svn at svn.open-ils.org svn at svn.open-ils.org
Thu May 29 22:10:45 EDT 2008


Author: erickson
Date: 2008-05-29 22:10:43 -0400 (Thu, 29 May 2008)
New Revision: 9734

Modified:
   trunk/Open-ILS/src/c-apps/oils_cstore.c
Log:
added check to make sure the db handle is not double-closed (causing segfaults)

Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c	2008-05-30 02:10:23 UTC (rev 9733)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c	2008-05-30 02:10:43 UTC (rev 9734)
@@ -79,15 +79,16 @@
 void osrfAppChildExit() {
 	osrfLogDebug(OSRF_LOG_MARK, "Child is exiting, disconnecting from database...");
 
-	if (writehandle) {
-		dbi_conn_query(writehandle, "ROLLBACK;");
-		dbi_conn_close(writehandle);
-		writehandle = NULL;
-	}
+    int same = 0;
+    if (writehandle == dbhandle) same = 1;
+    if (writehandle) {
+        dbi_conn_query(writehandle, "ROLLBACK;");
+        dbi_conn_close(writehandle);
+        writehandle = NULL;
+    }
+    if (dbhandle && !same)
+        dbi_conn_close(dbhandle);
 
-	if (dbhandle)
-		dbi_conn_close(dbhandle);
-
 	// XXX add cleanup of readHandles whenever that gets used
 
 	return;



More information about the open-ils-commits mailing list