Skip to content

Commit c6f6dff

Browse files
Mladen TurkFelipe Zimmerle
authored andcommitted
Move locking before table update
1 parent 84d2f30 commit c6f6dff

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

apache2/persist_dbm.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,14 @@ int collection_store(modsec_rec *msr, apr_table_t *col) {
384384
log_escape(msr->mp, dbm_filename));
385385
}
386386

387+
/* Need to lock to pull in the stored data again and apply deltas. */
388+
rc = apr_global_mutex_lock(msr->modsecurity->dbm_lock);
389+
if (rc != APR_SUCCESS) {
390+
msr_log(msr, 1, "collection_store: Failed to lock proc mutex: %s",
391+
get_apr_error(msr->mp, rc));
392+
goto error;
393+
}
394+
387395
/* Delete IS_NEW on store. */
388396
apr_table_unset(col, "IS_NEW");
389397

@@ -431,14 +439,6 @@ int collection_store(modsec_rec *msr, apr_table_t *col) {
431439
var->value = apr_psprintf(msr->mp, "%d", counter + 1);
432440
var->value_len = strlen(var->value);
433441
}
434-
435-
/* Need to lock to pull in the stored data again and apply deltas. */
436-
rc = apr_global_mutex_lock(msr->modsecurity->dbm_lock);
437-
if (rc != APR_SUCCESS) {
438-
msr_log(msr, 1, "collection_store: Failed to lock proc mutex: %s",
439-
get_apr_error(msr->mp, rc));
440-
goto error;
441-
}
442442

443443
/* ENH Make the expiration timestamp accessible in blob form so that
444444
* it is easier/faster to determine expiration without having to

0 commit comments

Comments
 (0)