diff options
author | tegge <tegge@FreeBSD.org> | 2002-09-06 15:02:24 +0000 |
---|---|---|
committer | tegge <tegge@FreeBSD.org> | 2002-09-06 15:02:24 +0000 |
commit | af98b559c1788e4e7128a109f940def083493de3 (patch) | |
tree | 9e52f1af6fbceaeaff8af270a8f7e9a79f43cef8 /devel/linuxthreads/files | |
parent | c61673e27e107aed049a0e54c37c9b0b5a7ead93 (diff) | |
download | FreeBSD-ports-af98b559c1788e4e7128a109f940def083493de3.zip FreeBSD-ports-af98b559c1788e4e7128a109f940def083493de3.tar.gz |
Don't assume that pthread_key_t is signed, thus plugging a memory leak.
Diffstat (limited to 'devel/linuxthreads/files')
-rw-r--r-- | devel/linuxthreads/files/localtime.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/devel/linuxthreads/files/localtime.c b/devel/linuxthreads/files/localtime.c index ce871ad..7b44f02 100644 --- a/devel/linuxthreads/files/localtime.c +++ b/devel/linuxthreads/files/localtime.c @@ -2,7 +2,7 @@ ** This file is in the public domain, so clarified as of ** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov). ** -** $FreeBSD: /tmp/pcvs/ports/devel/linuxthreads/files/localtime.c,v 1.2 2002-06-08 18:15:54 tegge Exp $ +** $FreeBSD: /tmp/pcvs/ports/devel/linuxthreads/files/localtime.c,v 1.3 2002-09-06 15:02:24 tegge Exp $ */ #ifndef lint @@ -1077,12 +1077,12 @@ localtime(timep) const time_t * const timep; { static pthread_mutex_t localtime_mutex = PTHREAD_MUTEX_INITIALIZER; - static pthread_key_t localtime_key = -1; + static pthread_key_t localtime_key = (pthread_key_t) -1; struct tm *p_tm; if (__isthreaded != 0) { pthread_mutex_lock(&localtime_mutex); - if (localtime_key < 0) { + if (localtime_key == (pthread_key_t) -1) { if (pthread_key_create(&localtime_key, free) < 0) { pthread_mutex_unlock(&localtime_mutex); return(NULL); @@ -1155,12 +1155,12 @@ gmtime(timep) const time_t * const timep; { static pthread_mutex_t gmtime_mutex = PTHREAD_MUTEX_INITIALIZER; - static pthread_key_t gmtime_key = -1; + static pthread_key_t gmtime_key = (pthread_key_t) -1; struct tm *p_tm; if (__isthreaded != 0) { pthread_mutex_lock(&gmtime_mutex); - if (gmtime_key < 0) { + if (gmtime_key == (pthread_key_t) -1) { if (pthread_key_create(&gmtime_key, free) < 0) { pthread_mutex_unlock(&gmtime_mutex); return(NULL); |