[mirrorbrain-commits] [mod_asn] r73 - /trunk/mod_asn.c

From: <poeml_at_mirrorbrain.org>
Date: Thu, 03 Dec 2009 23:02:05 -0000
Author: poeml
Date: Fri Dec  4 00:02:03 2009
New Revision: 73

URL: http://svn.mirrorbrain.org/viewvc/mod_asn?rev=73&view=rev
Log:
When compiling for APR 1.2, use different semantics to access database rows,
couting from 0 instead of from 1.  It seems to work either way (maybe because
only a single row is accessed), but maybe it's hopefully safer.  See
http://mirrorbrain.org/issues/issue29 and http://mirrorbrain.org/issues/issue7

Modified:
    trunk/mod_asn.c

Modified: trunk/mod_asn.c
URL: http://svn.mirrorbrain.org/viewvc/mod_asn/trunk/mod_asn.c?rev=73&r1=72&r2=73&view=diff
==============================================================================
--- trunk/mod_asn.c (original)
+++ trunk/mod_asn.c Fri Dec  4 00:02:03 2009
_at_@ -35,6 +35,7 @@
 #include "http_main.h"
 #include "http_protocol.h"
 
+#include "apr_version.h"
 #include "apr_strings.h"
 #include "apr_lib.h"
 #include "apr_dbd.h"
_at_@ -45,7 +46,7 @@
 #define UNSET (-1)
 #endif
 
-#define MOD_ASN_VER "1.3"
+#define MOD_ASN_VER "1.4"
 #define VERSION_COMPONENT "mod_asn/"MOD_ASN_VER
 
 /* from ssl/ssl_engine_config.c */
_at_@ -306,9 +307,14 @@
         return DECLINED;
     }
 
+#if (APR_MAJOR_VERSION == 1 && APR_MINOR_VERSION == 2)
+#define DBD_FIRST_ROW 0
+#else
+#define DBD_FIRST_ROW 1
+#endif
 
     /* we care only about the 1st row, because our query uses 'limit 1' */
-    rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, 1);
+    rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, DBD_FIRST_ROW);
     if (rv != 0) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                       "[mod_asn] Error retrieving row from database for %s", 
_at_@ -326,7 +332,7 @@
     }
 
     /* clear the cursor by accessing invalid row */
-    rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, 2);
+    rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, DBD_FIRST_ROW + 1);
     if (rv != -1) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                       "[mod_asn] found one row too much looking up %s", 




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Thu Dec 03 2009 - 23:02:07 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT