+ Added checks for NULL and NULL string names (for sem_open & sem_unlink).

This commit is contained in:
Jennifer Averett
1999-11-22 16:08:53 +00:00
parent 0ebf569402
commit f85409cf9c
2 changed files with 14 additions and 2 deletions

View File

@@ -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;
} }

View File

@@ -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;
} }