diff options
author | ivan <ivan@13f79535-47bb-0310-9956-ffa450edef68> | 2019-05-19 17:34:34 +0000 |
---|---|---|
committer | ivan <ivan@13f79535-47bb-0310-9956-ffa450edef68> | 2019-05-19 17:34:34 +0000 |
commit | a54ea12557d02ff4fe62aba244240aad3f57e811 (patch) | |
tree | f14667127a010623aec44bdae0103e27d7db7e73 /dso/win32 | |
parent | 261782e842ef6dc8d5bdf05e384f9f039df92c99 (diff) | |
download | libapr-a54ea12557d02ff4fe62aba244240aad3f57e811.tar.gz |
* dso/win32/dso.c
(apr_dso_load): Use SetThreadErrorMode() instead of SetErrorMode(), because
SetErrorMode() is not thread-safe.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1859519 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dso/win32')
-rw-r--r-- | dso/win32/dso.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/dso/win32/dso.c b/dso/win32/dso.c index 3433c7e31..9681d91b5 100644 --- a/dso/win32/dso.c +++ b/dso/win32/dso.c @@ -69,7 +69,10 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, } /* Prevent ugly popups from killing our app */ #ifndef _WIN32_WCE - em = SetErrorMode(SEM_FAILCRITICALERRORS); + if (!SetThreadErrorMode(SEM_FAILCRITICALERRORS, &em)) { + *res_handle = apr_pcalloc(ctx, sizeof(**res_handle)); + return ((*res_handle)->load_error = apr_get_os_error()); + } #endif os_handle = LoadLibraryExW(wpath, NULL, 0); if (!os_handle) @@ -87,7 +90,7 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, #endif } #ifndef _WIN32_WCE - SetErrorMode(em); + SetThreadErrorMode(em, NULL); #endif *res_handle = apr_pcalloc(ctx, sizeof(**res_handle)); |