From: Kern Sibbald Date: Sat, 12 Jul 2008 15:48:52 +0000 (+0000) Subject: Fix bug in Win32 pthread pthread_getspecific function X-Git-Tag: Release-3.0.0~1158 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d1d451f9012125c474394f3309e94cebf96935f5;p=bacula%2Fbacula Fix bug in Win32 pthread pthread_getspecific function git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7360 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/win32/patches/pthreads.patch b/bacula/src/win32/patches/pthreads.patch index b5c9327308..3f6113738e 100644 --- a/bacula/src/win32/patches/pthreads.patch +++ b/bacula/src/win32/patches/pthreads.patch @@ -67,3 +67,29 @@ Index: ptw32_semwait.c ptw32_semwait (sem_t * sem) /* * ------------------------------------------------------ +--- /tmp/pthread_getspecific.c.bak 2008-07-12 17:26:03.000000000 +0200 ++++ pthread_getspecific.c 2008-07-12 17:26:03.000000000 +0200 +@@ -63,13 +63,18 @@ + * ------------------------------------------------------ + */ + { +- int lasterror = GetLastError (); +- int lastWSAerror = WSAGetLastError (); ++ void *ptr; + +- void *ptr = TlsGetValue (key->key); ++ if (key == NULL) { ++ ptr = NULL; ++ } else { ++ int lasterror = GetLastError (); ++ int lastWSAerror = WSAGetLastError (); + +- SetLastError (lasterror); +- WSASetLastError (lastWSAerror); ++ ptr = TlsGetValue(key->key); + ++ SetLastError(lasterror); ++ WSASetLastError(lastWSAerror); ++ } + return ptr; + }