mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-08-24 12:21:57 +08:00
added code to catch NULL pointers for return values passed to get routines
This commit is contained in:
@@ -146,7 +146,7 @@ int pthread_mutexattr_destroy(
|
||||
pthread_mutexattr_t *attr
|
||||
)
|
||||
{
|
||||
if ( !attr || attr->is_initialized == FALSE )
|
||||
if ( !attr || !attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
attr->is_initialized = FALSE;
|
||||
@@ -163,7 +163,7 @@ int pthread_mutexattr_getpshared(
|
||||
int *pshared
|
||||
)
|
||||
{
|
||||
if ( !attr || attr->is_initialized == FALSE )
|
||||
if ( !attr || !attr->is_initialized || !pshared )
|
||||
return EINVAL;
|
||||
|
||||
*pshared = attr->process_shared;
|
||||
@@ -180,7 +180,7 @@ int pthread_mutexattr_setpshared(
|
||||
int pshared
|
||||
)
|
||||
{
|
||||
if ( !attr || attr->is_initialized == FALSE )
|
||||
if ( !attr || !attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
switch ( pshared ) {
|
||||
@@ -531,7 +531,7 @@ int pthread_mutexattr_getprotocol(
|
||||
int *protocol
|
||||
)
|
||||
{
|
||||
if ( !attr || attr->is_initialized == FALSE )
|
||||
if ( !attr || !attr->is_initialized || !protocol )
|
||||
return EINVAL;
|
||||
|
||||
*protocol = attr->protocol;
|
||||
@@ -548,7 +548,7 @@ int pthread_mutexattr_setprioceiling(
|
||||
int prioceiling
|
||||
)
|
||||
{
|
||||
if ( !attr || attr->is_initialized == FALSE )
|
||||
if ( !attr || !attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
if ( !_POSIX_Priority_Is_valid( attr->prio_ceiling ) )
|
||||
@@ -568,7 +568,7 @@ int pthread_mutexattr_getprioceiling(
|
||||
int *prioceiling
|
||||
)
|
||||
{
|
||||
if ( !attr || attr->is_initialized == FALSE )
|
||||
if ( !attr || !attr->is_initialized || !prioceiling )
|
||||
return EINVAL;
|
||||
|
||||
*prioceiling = attr->prio_ceiling;
|
||||
@@ -639,6 +639,9 @@ int pthread_mutex_getprioceiling(
|
||||
register POSIX_Mutex_Control *the_mutex;
|
||||
Objects_Locations location;
|
||||
|
||||
if ( !prioceiling )
|
||||
return EINVAL;
|
||||
|
||||
the_mutex = _POSIX_Mutex_Get( mutex, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
|
||||
@@ -146,7 +146,7 @@ int pthread_mutexattr_destroy(
|
||||
pthread_mutexattr_t *attr
|
||||
)
|
||||
{
|
||||
if ( !attr || attr->is_initialized == FALSE )
|
||||
if ( !attr || !attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
attr->is_initialized = FALSE;
|
||||
@@ -163,7 +163,7 @@ int pthread_mutexattr_getpshared(
|
||||
int *pshared
|
||||
)
|
||||
{
|
||||
if ( !attr || attr->is_initialized == FALSE )
|
||||
if ( !attr || !attr->is_initialized || !pshared )
|
||||
return EINVAL;
|
||||
|
||||
*pshared = attr->process_shared;
|
||||
@@ -180,7 +180,7 @@ int pthread_mutexattr_setpshared(
|
||||
int pshared
|
||||
)
|
||||
{
|
||||
if ( !attr || attr->is_initialized == FALSE )
|
||||
if ( !attr || !attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
switch ( pshared ) {
|
||||
@@ -531,7 +531,7 @@ int pthread_mutexattr_getprotocol(
|
||||
int *protocol
|
||||
)
|
||||
{
|
||||
if ( !attr || attr->is_initialized == FALSE )
|
||||
if ( !attr || !attr->is_initialized || !protocol )
|
||||
return EINVAL;
|
||||
|
||||
*protocol = attr->protocol;
|
||||
@@ -548,7 +548,7 @@ int pthread_mutexattr_setprioceiling(
|
||||
int prioceiling
|
||||
)
|
||||
{
|
||||
if ( !attr || attr->is_initialized == FALSE )
|
||||
if ( !attr || !attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
if ( !_POSIX_Priority_Is_valid( attr->prio_ceiling ) )
|
||||
@@ -568,7 +568,7 @@ int pthread_mutexattr_getprioceiling(
|
||||
int *prioceiling
|
||||
)
|
||||
{
|
||||
if ( !attr || attr->is_initialized == FALSE )
|
||||
if ( !attr || !attr->is_initialized || !prioceiling )
|
||||
return EINVAL;
|
||||
|
||||
*prioceiling = attr->prio_ceiling;
|
||||
@@ -639,6 +639,9 @@ int pthread_mutex_getprioceiling(
|
||||
register POSIX_Mutex_Control *the_mutex;
|
||||
Objects_Locations location;
|
||||
|
||||
if ( !prioceiling )
|
||||
return EINVAL;
|
||||
|
||||
the_mutex = _POSIX_Mutex_Get( mutex, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
|
||||
Reference in New Issue
Block a user