apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r692751 - in /apr/apr-util/trunk: CHANGES test/testdbd.c
Date Sat, 06 Sep 2008 22:19:10 GMT
Author: minfrin
Date: Sat Sep  6 15:19:08 2008
New Revision: 692751

URL: http://svn.apache.org/viewvc?rev=692751&view=rev
Log:
Fix a segfault in the DBD testcase when the DBD modules were not present.

Modified:
    apr/apr-util/trunk/CHANGES
    apr/apr-util/trunk/test/testdbd.c

Modified: apr/apr-util/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/CHANGES?rev=692751&r1=692750&r2=692751&view=diff
==============================================================================
--- apr/apr-util/trunk/CHANGES [utf-8] (original)
+++ apr/apr-util/trunk/CHANGES [utf-8] Sat Sep  6 15:19:08 2008
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes with APR-util 1.4.0
 
+  *) Fix a segfault in the DBD testcase when the DBD modules were not present.
+     [Graham Leggett]
+
   *) Add DTrace Probes to Hooks, making it easier to inspect APR Hook based
      applications with DTrace. [Theo Schlossnagle <jesus omniti.com>]
 

Modified: apr/apr-util/trunk/test/testdbd.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/test/testdbd.c?rev=692751&r1=692750&r2=692751&view=diff
==============================================================================
--- apr/apr-util/trunk/test/testdbd.c (original)
+++ apr/apr-util/trunk/test/testdbd.c Sat Sep  6 15:19:08 2008
@@ -31,7 +31,7 @@
 }
 
 #if APU_HAVE_SQLITE2 || APU_HAVE_SQLITE3
-static void test_statement(abts_case *tc, apr_dbd_t* handle, 
+static void test_statement(abts_case *tc, apr_dbd_t* handle,
                            const apr_dbd_driver_t* driver, const char* sql)
 {
     int nrows;
@@ -42,7 +42,7 @@
     ABTS_ASSERT(tc, sql, rv == APR_SUCCESS);
 }
 
-static void create_table(abts_case *tc, apr_dbd_t* handle, 
+static void create_table(abts_case *tc, apr_dbd_t* handle,
                          const apr_dbd_driver_t* driver)
 {
     const char *sql = "CREATE TABLE apr_dbd_test ("
@@ -53,14 +53,14 @@
     test_statement(tc, handle, driver, sql);
 }
 
-static void drop_table(abts_case *tc, apr_dbd_t* handle, 
+static void drop_table(abts_case *tc, apr_dbd_t* handle,
                        const apr_dbd_driver_t* driver)
 {
     const char *sql = "DROP TABLE apr_dbd_test";
     test_statement(tc, handle, driver, sql);
 }
 
-static void delete_rows(abts_case *tc, apr_dbd_t* handle, 
+static void delete_rows(abts_case *tc, apr_dbd_t* handle,
                         const apr_dbd_driver_t* driver)
 {
     const char *sql = "DELETE FROM apr_dbd_test";
@@ -68,7 +68,7 @@
 }
 
 
-static void insert_data(abts_case *tc, apr_dbd_t* handle, 
+static void insert_data(abts_case *tc, apr_dbd_t* handle,
                         const apr_dbd_driver_t* driver, int count)
 {
     apr_pool_t* pool = p;
@@ -86,7 +86,7 @@
     }
 }
 
-static void select_rows(abts_case *tc, apr_dbd_t* handle, 
+static void select_rows(abts_case *tc, apr_dbd_t* handle,
                         const apr_dbd_driver_t* driver, int count)
 {
     apr_status_t rv;
@@ -144,7 +144,7 @@
   ABTS_STR_EQUAL(tc, "foo''bar", escaped);
 }
 
-static void test_dbd_generic(abts_case *tc, apr_dbd_t* handle, 
+static void test_dbd_generic(abts_case *tc, apr_dbd_t* handle,
                              const apr_dbd_driver_t* driver)
 {
     void* native;
@@ -182,12 +182,18 @@
     rv = apr_dbd_get_driver(pool, "sqlite2", &driver);
     ABTS_ASSERT(tc, "failed to fetch driver", rv == APR_SUCCESS);
     ABTS_PTR_NOTNULL(tc, driver);
+    if (!driver) {
+    	return;
+    }
 
     ABTS_STR_EQUAL(tc, "sqlite2", apr_dbd_name(driver));
 
     rv = apr_dbd_open(driver, pool, "data/sqlite2.db:600", &handle);
     ABTS_ASSERT(tc, "failed to open database", rv == APR_SUCCESS);
     ABTS_PTR_NOTNULL(tc, handle);
+    if (!handle) {
+    	return;
+    }
 
     test_dbd_generic(tc, handle, driver);
 }
@@ -204,12 +210,18 @@
     rv = apr_dbd_get_driver(pool, "sqlite3", &driver);
     ABTS_ASSERT(tc, "failed to fetch driver", rv == APR_SUCCESS);
     ABTS_PTR_NOTNULL(tc, driver);
+    if (!driver) {
+    	return;
+    }
 
     ABTS_STR_EQUAL(tc, "sqlite3", apr_dbd_name(driver));
 
     rv = apr_dbd_open(driver, pool, "data/sqlite3.db", &handle);
     ABTS_ASSERT(tc, "failed to open database", rv == APR_SUCCESS);
     ABTS_PTR_NOTNULL(tc, handle);
+    if (!handle) {
+    	return;
+    }
 
     test_dbd_generic(tc, handle, driver);
 }



Mime
View raw message