]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix bug in Win32 pthread pthread_getspecific function
authorKern Sibbald <kern@sibbald.com>
Sat, 12 Jul 2008 15:48:17 +0000 (15:48 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 12 Jul 2008 15:48:17 +0000 (15:48 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.4@7359 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/win32/patches/pthreads.patch

index b5c9327308df1bef4defaeddbd400467ed750ca3..3f6113738e7b45297c3d7b87bc47274f3c5dc8ba 100644 (file)
@@ -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;
+ }