diff options
Diffstat (limited to 'pjlib/src/pj')
-rw-r--r-- | pjlib/src/pj/errno.c | 8 | ||||
-rw-r--r-- | pjlib/src/pj/ssl_sock_ossl.c | 16 |
2 files changed, 14 insertions, 10 deletions
diff --git a/pjlib/src/pj/errno.c b/pjlib/src/pj/errno.c index e36b3266..40ac9779 100644 --- a/pjlib/src/pj/errno.c +++ b/pjlib/src/pj/errno.c @@ -128,6 +128,14 @@ PJ_DEF(pj_status_t) pj_register_strerror( pj_status_t start, if (IN_RANGE(start, err_msg_hnd[i].begin, err_msg_hnd[i].end) || IN_RANGE(start+space-1, err_msg_hnd[i].begin, err_msg_hnd[i].end)) { + if (err_msg_hnd[i].begin == start && + err_msg_hnd[i].end == (start+space) && + err_msg_hnd[i].strerror == f) + { + /* The same range and handler has already been registered */ + return PJ_SUCCESS; + } + return PJ_EEXISTS; } } diff --git a/pjlib/src/pj/ssl_sock_ossl.c b/pjlib/src/pj/ssl_sock_ossl.c index 97458835..98888906 100644 --- a/pjlib/src/pj/ssl_sock_ossl.c +++ b/pjlib/src/pj/ssl_sock_ossl.c @@ -267,7 +267,6 @@ static pj_str_t ssl_strerror(pj_status_t status, /* OpenSSL library initialization counter */ static int openssl_init_count; -static int openssl_reg_strerr; /* OpenSSL available ciphers */ static pj_ssl_cipher openssl_ciphers[100]; @@ -280,21 +279,18 @@ static int sslsock_idx; /* Initialize OpenSSL */ static pj_status_t init_openssl(void) { + pj_status_t status; + if (openssl_init_count) return PJ_SUCCESS; openssl_init_count = 1; /* Register error subsystem */ - if (!openssl_reg_strerr) { - pj_status_t status; - - openssl_reg_strerr = 1; - status = pj_register_strerror(PJ_SSL_ERRNO_START, - PJ_SSL_ERRNO_SPACE_SIZE, - &ssl_strerror); - pj_assert(status == PJ_SUCCESS); - } + status = pj_register_strerror(PJ_SSL_ERRNO_START, + PJ_SSL_ERRNO_SPACE_SIZE, + &ssl_strerror); + pj_assert(status == PJ_SUCCESS); /* Init OpenSSL lib */ SSL_library_init(); |