forked from Imagelibrary/rtems
+ Added checks for NULL and NULL string names (for sem_open & sem_unlink).
This commit is contained in:
@@ -31,12 +31,18 @@ int _POSIX_Semaphore_Name_to_id(
|
|||||||
{
|
{
|
||||||
Objects_Name_to_id_errors status;
|
Objects_Name_to_id_errors status;
|
||||||
|
|
||||||
|
if ( !name )
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
|
if ( !name[0] )
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
status = _Objects_Name_to_id(
|
status = _Objects_Name_to_id(
|
||||||
&_POSIX_Semaphore_Information, (char *)name, 0, id );
|
&_POSIX_Semaphore_Information, (char *)name, 0, id );
|
||||||
|
|
||||||
if ( status == OBJECTS_SUCCESSFUL )
|
if ( status == OBJECTS_SUCCESSFUL )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return EINVAL;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,12 +31,18 @@ int _POSIX_Semaphore_Name_to_id(
|
|||||||
{
|
{
|
||||||
Objects_Name_to_id_errors status;
|
Objects_Name_to_id_errors status;
|
||||||
|
|
||||||
|
if ( !name )
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
|
if ( !name[0] )
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
status = _Objects_Name_to_id(
|
status = _Objects_Name_to_id(
|
||||||
&_POSIX_Semaphore_Information, (char *)name, 0, id );
|
&_POSIX_Semaphore_Information, (char *)name, 0, id );
|
||||||
|
|
||||||
if ( status == OBJECTS_SUCCESSFUL )
|
if ( status == OBJECTS_SUCCESSFUL )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return EINVAL;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user