summaryrefslogtreecommitdiff
path: root/locks
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2002-02-01 06:21:34 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2002-02-01 06:21:34 +0000
commit6b7dcaa03ca405bf81d4e425afbc9770807db626 (patch)
tree459d9f7bf4ac5867fe72e7076d85cf96bf24308c /locks
parent043718f9ba9daa74768029b48b6ab960dfd51655 (diff)
downloadlibapr-6b7dcaa03ca405bf81d4e425afbc9770807db626.tar.gz
Win32 mod_rewrite was broken by the implicit assumption that fname would
have a value. Of course, fname may be NULL, in which case this patch from 1.46 broke any NULL locking. Correct the Local/Global fix for NULL lock names. Oh most excelent RM of .31, please consider this patch, without which mod_rewrite will not load. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62890 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r--locks/win32/locks.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/locks/win32/locks.c b/locks/win32/locks.c
index 1730a4a34..62abb6962 100644
--- a/locks/win32/locks.c
+++ b/locks/win32/locks.c
@@ -119,7 +119,12 @@ APR_DECLARE(apr_status_t) apr_lock_create(apr_lock_t **lock,
}
if (scope == APR_INTRAPROCESS) {
- newlock->fname = apr_pstrdup(pool, fname);
+ if (fname) {
+ newlock->fname = apr_pstrdup(pool, fname);
+ }
+ else {
+ newlock->fname = NULL;
+ }
InitializeCriticalSection(&newlock->section);
} else {
/* With Win2000 Terminal Services, the Mutex name can have a
@@ -128,10 +133,17 @@ APR_DECLARE(apr_status_t) apr_lock_create(apr_lock_t **lock,
* running on Win2000, Global\ and Local\ are ignored. These
* prefixes are only valid on Win2000+
*/
- if (apr_os_level >= APR_WIN_2000)
- newlock->fname = apr_pstrcat(pool, "Global\\", fname, NULL);
- else
- newlock->fname = apr_pstrdup(pool, fname);
+ if (fname) {
+ if (apr_os_level >= APR_WIN_2000) {
+ newlock->fname = apr_pstrcat(pool, "Global\\", fname, NULL);
+ }
+ else {
+ newlock->fname = apr_pstrdup(pool, fname);
+ }
+ }
+ else {
+ newlock->fname = NULL;
+ }
newlock->mutex = CreateMutex(&sec, FALSE, newlock->fname);
if (!newlock->mutex) {
@@ -156,7 +168,18 @@ APR_DECLARE(apr_status_t) apr_lock_child_init(apr_lock_t **lock,
if ((*lock) == NULL) {
return APR_ENOMEM;
}
- (*lock)->fname = apr_pstrdup(pool, fname);
+ if (fname) {
+ if (apr_os_level >= APR_WIN_2000) {
+ (*lock)->fname = apr_pstrcat(pool, "Global\\", fname, NULL);
+ }
+ else {
+ (*lock)->fname = apr_pstrdup(pool, fname);
+ }
+ }
+ else {
+ return APR_EINVAL;
+ }
+
(*lock)->mutex = OpenMutex(MUTEX_ALL_ACCESS, TRUE, fname);
if ((*lock)->mutex == NULL) {