diff options
Diffstat (limited to 'net/third_party/nss/ssl/sslmutex.c')
-rw-r--r-- | net/third_party/nss/ssl/sslmutex.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/net/third_party/nss/ssl/sslmutex.c b/net/third_party/nss/ssl/sslmutex.c index 8403365..ab612d6 100644 --- a/net/third_party/nss/ssl/sslmutex.c +++ b/net/third_party/nss/ssl/sslmutex.c @@ -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 @@ loser: } 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 @@ sslMutex_Destroy(sslMutex *pMutex) 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 @@ sslMutex_Init(sslMutex *pMutex, int shared) } SECStatus -sslMutex_Destroy(sslMutex *pMutex) +sslMutex_Destroy(sslMutex *pMutex, PRBool processLocal) { HANDLE hMutex; int rv; @@ -435,9 +439,10 @@ sslMutex_Destroy(sslMutex *pMutex) } 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 @@ sslMutex_Init(sslMutex *pMutex, int shared) } 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 @@ sslMutex_Init(sslMutex *pMutex, int shared) } SECStatus -sslMutex_Destroy(sslMutex *pMutex) +sslMutex_Destroy(sslMutex *pMutex, PRBool processLocal) { PR_ASSERT(pMutex); if (PR_FALSE == pMutex->isMultiProcess) { |