You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by iv...@apache.org on 2019/05/19 17:34:35 UTC

svn commit: r1859519 - /apr/apr/trunk/dso/win32/dso.c

Author: ivan
Date: Sun May 19 17:34:34 2019
New Revision: 1859519

URL: http://svn.apache.org/viewvc?rev=1859519&view=rev
Log:
* dso/win32/dso.c
  (apr_dso_load): Use SetThreadErrorMode() instead of SetErrorMode(), because
   SetErrorMode() is not thread-safe.

Modified:
    apr/apr/trunk/dso/win32/dso.c

Modified: apr/apr/trunk/dso/win32/dso.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/dso/win32/dso.c?rev=1859519&r1=1859518&r2=1859519&view=diff
==============================================================================
--- apr/apr/trunk/dso/win32/dso.c (original)
+++ apr/apr/trunk/dso/win32/dso.c Sun May 19 17:34:34 2019
@@ -69,7 +69,10 @@ APR_DECLARE(apr_status_t) apr_dso_load(s
     }
     /* 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(s
 #endif
     }
 #ifndef _WIN32_WCE
-    SetErrorMode(em);
+    SetThreadErrorMode(em, NULL);
 #endif
 
     *res_handle = apr_pcalloc(ctx, sizeof(**res_handle));