Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpthread pthread_rwlock_timedrdlock() and pthread_rwlo...



details:   https://anonhg.NetBSD.org/src/rev/9019149bba94
branches:  trunk
changeset: 572606:9019149bba94
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Sun Jan 09 01:47:20 2005 +0000

description:
pthread_rwlock_timedrdlock() and pthread_rwlock_timedwrlock():
Expand the test for valid values of abs_timeout to check for negative
values of tv_sec and tv_nsec.

diffstat:

 lib/libpthread/pthread_rwlock.c |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (47 lines):

diff -r af5bf05b4fd0 -r 9019149bba94 lib/libpthread/pthread_rwlock.c
--- a/lib/libpthread/pthread_rwlock.c   Sun Jan 09 01:32:32 2005 +0000
+++ b/lib/libpthread/pthread_rwlock.c   Sun Jan 09 01:47:20 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_rwlock.c,v 1.9 2004/08/03 11:50:45 yamt Exp $ */
+/*     $NetBSD: pthread_rwlock.c,v 1.10 2005/01/09 01:47:20 nathanw Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_rwlock.c,v 1.9 2004/08/03 11:50:45 yamt Exp $");
+__RCSID("$NetBSD: pthread_rwlock.c,v 1.10 2005/01/09 01:47:20 nathanw Exp $");
 
 #include <errno.h>
 
@@ -251,9 +251,13 @@
 #ifdef ERRORCHECK
        if ((rwlock == NULL) || (rwlock->ptr_magic != _PT_RWLOCK_MAGIC))
                return EINVAL;
-       if ((abs_timeout == NULL) || (abs_timeout->tv_nsec >= 1000000000))
+       if (abs_timeout == NULL)
                return EINVAL;
 #endif
+       if ((abs_timeout->tv_nsec >= 1000000000) ||
+           (abs_timeout->tv_nsec < 0) ||
+           (abs_timeout->tv_sec < 0))
+               return EINVAL;
        self = pthread__self();
        
        pthread_spinlock(self, &rwlock->ptr_interlock);
@@ -311,7 +315,13 @@
 #ifdef ERRORCHECK
        if ((rwlock == NULL) || (rwlock->ptr_magic != _PT_RWLOCK_MAGIC))
                return EINVAL;
+       if (abs_timeout == NULL)
+               return EINVAL;
 #endif
+       if ((abs_timeout->tv_nsec >= 1000000000) ||
+           (abs_timeout->tv_nsec < 0) ||
+           (abs_timeout->tv_sec < 0))
+               return EINVAL;
        self = pthread__self();
        
        pthread_spinlock(self, &rwlock->ptr_interlock);



Home | Main Index | Thread Index | Old Index