@@ -122,7 +122,7 @@ msc_engine *modsecurity_create(apr_pool_t *mp, int processing_mode) {
122122 return msce ;
123123}
124124
125- int acquire_global_lock (apr_global_mutex_t * lock , apr_pool_t * mp ) {
125+ int acquire_global_lock (apr_global_mutex_t * * lock , apr_pool_t * mp ) {
126126 apr_status_t rc ;
127127 apr_file_t * lock_name ;
128128 const char * temp_dir ;
@@ -146,19 +146,20 @@ int acquire_global_lock(apr_global_mutex_t *lock, apr_pool_t *mp) {
146146 // below func always return APR_SUCCESS
147147 apr_file_name_get (& filename , lock_name );
148148
149- rc = apr_global_mutex_create (& lock , filename , APR_LOCK_DEFAULT , mp );
149+ rc = apr_global_mutex_create (lock , filename , APR_LOCK_DEFAULT , mp );
150150 if (rc != APR_SUCCESS ) {
151151 ap_log_perror (APLOG_MARK , APLOG_ERR , 0 , NULL , " ModSecurity: Could not create global mutex" );
152152 return -1 ;
153153 }
154154#if !defined(MSC_TEST )
155155#ifdef __SET_MUTEX_PERMS
156156#if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
157- rc = ap_unixd_set_global_mutex_perms (lock );
157+ rc = ap_unixd_set_global_mutex_perms (* lock );
158158#else
159- rc = unixd_set_global_mutex_perms (lock );
159+ rc = unixd_set_global_mutex_perms (* lock );
160160#endif
161161 if (rc != APR_SUCCESS ) {
162+ ap_log_perror (APLOG_MARK , APLOG_ERR , 0 , NULL , " ModSecurity: Could not set permissions on global mutex" );
162163 return -1 ;
163164 }
164165#endif /* SET_MUTEX_PERMS */
@@ -189,21 +190,15 @@ int modsecurity_init(msc_engine *msce, apr_pool_t *mp) {
189190 curl_global_init (CURL_GLOBAL_ALL );
190191#endif
191192 /* Serial audit log mutex */
192- rc = acquire_global_lock (msce -> auditlog_lock , mp );
193- if (rc != APR_SUCCESS ) {
194- return -1 ;
195- }
193+ rc = acquire_global_lock (& msce -> auditlog_lock , mp );
194+ if (rc != APR_SUCCESS ) return -1 ;
196195
197- rc = acquire_global_lock (msce -> geo_lock , mp );
198- if (rc != APR_SUCCESS ) {
199- return -1 ;
200- }
196+ rc = acquire_global_lock (& msce -> geo_lock , mp );
197+ if (rc != APR_SUCCESS ) return -1 ;
201198
202199#ifdef GLOBAL_COLLECTION_LOCK
203200 rc = acquire_global_lock (& msce -> dbm_lock , mp );
204- if (rc != APR_SUCCESS ) {
205- return -1 ;
206- }
201+ if (rc != APR_SUCCESS ) return -1 ;
207202#endif /* GLOBAL_COLLECTION_LOCK */
208203
209204 return 1 ;
0 commit comments