From 91f42a2d730786fba0675fd39379ac2216b95d08 Mon Sep 17 00:00:00 2001 From: rpj Date: Mon, 22 Nov 2004 08:28:15 +0000 Subject: Copyright update --- pthread_getspecific.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'pthread_getspecific.c') diff --git a/pthread_getspecific.c b/pthread_getspecific.c index e48fa47..4cb474c 100644 --- a/pthread_getspecific.c +++ b/pthread_getspecific.c @@ -8,7 +8,7 @@ * * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2003 Pthreads-win32 contributors + * Copyright(C) 1999,2004 Pthreads-win32 contributors * * Contact Email: rpj@callisto.canberra.edu.au * @@ -63,13 +63,22 @@ pthread_getspecific (pthread_key_t key) * ------------------------------------------------------ */ { - 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; } -- cgit v1.2.3