[open-ils-commits] r9732 - branches/rel_1_2_2/Open-ILS/src/c-apps

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


Author: erickson
Date: 2008-05-29 22:09:27 -0400 (Thu, 29 May 2008)
New Revision: 9732

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

Modified: branches/rel_1_2_2/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- branches/rel_1_2_2/Open-ILS/src/c-apps/oils_cstore.c	2008-05-29 22:27:08 UTC (rev 9731)
+++ branches/rel_1_2_2/Open-ILS/src/c-apps/oils_cstore.c	2008-05-30 02:09:27 UTC (rev 9732)
@@ -73,15 +73,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