Index: net/third_party/nss/ssl/sslmutex.c |
=================================================================== |
--- net/third_party/nss/ssl/sslmutex.c (revision 124804) |
+++ net/third_party/nss/ssl/sslmutex.c (working copy) |
@@ -33,7 +33,7 @@ |
* the terms of any one of the MPL, the GPL or the LGPL. |
* |
* ***** END LICENSE BLOCK ***** */ |
-/* $Id: sslmutex.c,v 1.25 2010/04/03 18:27:33 nelson%bolyard.com Exp $ */ |
+/* $Id: sslmutex.c,v 1.27 2011/10/01 00:11:02 wtc%google.com Exp $ */ |
#include "seccomon.h" |
/* This ifdef should match the one in sslsnce.c */ |
@@ -168,7 +168,7 @@ |
} |
SECStatus |
-sslMutex_Destroy(sslMutex *pMutex) |
+sslMutex_Destroy(sslMutex *pMutex, PRBool processLocal) |
{ |
if (PR_FALSE == pMutex->isMultiProcess) { |
return single_process_sslMutex_Destroy(pMutex); |
@@ -180,6 +180,10 @@ |
close(pMutex->u.pipeStr.mPipes[0]); |
close(pMutex->u.pipeStr.mPipes[1]); |
+ if (processLocal) { |
+ return SECSuccess; |
+ } |
+ |
pMutex->u.pipeStr.mPipes[0] = -1; |
pMutex->u.pipeStr.mPipes[1] = -1; |
pMutex->u.pipeStr.mPipes[2] = -1; |
@@ -409,7 +413,7 @@ |
} |
SECStatus |
-sslMutex_Destroy(sslMutex *pMutex) |
+sslMutex_Destroy(sslMutex *pMutex, PRBool processLocal) |
{ |
HANDLE hMutex; |
int rv; |
@@ -435,9 +439,10 @@ |
} |
rv = CloseHandle(hMutex); /* ignore error */ |
- if (rv) { |
+ if (!processLocal && rv) { |
pMutex->u.sslMutx = hMutex = INVALID_HANDLE_VALUE; |
- } else { |
+ } |
+ if (!rv) { |
nss_MD_win32_map_default_error(GetLastError()); |
retvalue = SECFailure; |
} |
@@ -557,12 +562,17 @@ |
} |
SECStatus |
-sslMutex_Destroy(sslMutex *pMutex) |
+sslMutex_Destroy(sslMutex *pMutex, PRBool processLocal) |
{ |
int rv; |
if (PR_FALSE == pMutex->isMultiProcess) { |
return single_process_sslMutex_Destroy(pMutex); |
} |
+ |
+ /* semaphores are global resources. See SEM_DESTROY(3) man page */ |
+ if (processLocal) { |
+ return SECSuccess; |
+ } |
do { |
rv = sem_destroy(&pMutex->u.sem); |
} while (rv < 0 && errno == EINTR); |
@@ -623,7 +633,7 @@ |
} |
SECStatus |
-sslMutex_Destroy(sslMutex *pMutex) |
+sslMutex_Destroy(sslMutex *pMutex, PRBool processLocal) |
{ |
PR_ASSERT(pMutex); |
if (PR_FALSE == pMutex->isMultiProcess) { |