diff options
author | Matt Caswell <matt@openssl.org> | 2016-05-23 13:52:29 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-05-23 23:26:10 +0100 |
commit | 7d37818dacc87c21dfc9d2def5014657344875e3 (patch) | |
tree | 459cf7a75959c26b09b1e91be893b5f4fe27b3fe /crypto/dso | |
parent | a93e0e78db78e03bdcd29acf9bbc8a812ee50cb6 (diff) |
Use strerror_r()/strerror_s() instead of strerror() where possible
The function strerror() is not thread safe. We should use strerror_r()
where possible, or strerror_s() on Windows.
RT#2267
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/dso')
-rw-r--r-- | crypto/dso/dso_dl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/dso/dso_dl.c b/crypto/dso/dso_dl.c index f5c51bfe85..bc29fb23e0 100644 --- a/crypto/dso/dso_dl.c +++ b/crypto/dso/dso_dl.c @@ -66,8 +66,10 @@ static int dl_load(DSO *dso) (dso->flags & DSO_FLAG_NO_NAME_TRANSLATION ? 0 : DYNAMIC_PATH), 0L); if (ptr == NULL) { + char errbuf[160]; DSOerr(DSO_F_DL_LOAD, DSO_R_LOAD_FAILED); - ERR_add_error_data(4, "filename(", filename, "): ", strerror(errno)); + if (openssl_strerror_r(errno, errbuf, sizeof(errbuf))) + ERR_add_error_data(4, "filename(", filename, "): ", errbuf); goto err; } if (!sk_push(dso->meth_data, (char *)ptr)) { @@ -130,8 +132,10 @@ static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname) return (NULL); } if (shl_findsym(&ptr, symname, TYPE_UNDEFINED, &sym) < 0) { + char errbuf[160]; DSOerr(DSO_F_DL_BIND_FUNC, DSO_R_SYM_FAILURE); - ERR_add_error_data(4, "symname(", symname, "): ", strerror(errno)); + if (openssl_strerror_r(errno, errbuf, sizeof(errbuf))) + ERR_add_error_data(4, "symname(", symname, "): ", errbuf); return (NULL); } return ((DSO_FUNC_TYPE)sym); |