From d1d451f9012125c474394f3309e94cebf96935f5 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 12 Jul 2008 15:48:52 +0000 Subject: [PATCH] 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 --- bacula/src/win32/patches/pthreads.patch | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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; + } -- 2.39.5