From f85409cf9c04f190fdde25f394c0e901757d56ff Mon Sep 17 00:00:00 2001 From: Jennifer Averett Date: Mon, 22 Nov 1999 16:08:53 +0000 Subject: + Added checks for NULL and NULL string names (for sem_open & sem_unlink). --- c/src/exec/posix/src/semaphorenametoid.c | 8 +++++++- cpukit/posix/src/semaphorenametoid.c | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/c/src/exec/posix/src/semaphorenametoid.c b/c/src/exec/posix/src/semaphorenametoid.c index c6de93c201..47879402cc 100644 --- a/c/src/exec/posix/src/semaphorenametoid.c +++ b/c/src/exec/posix/src/semaphorenametoid.c @@ -31,12 +31,18 @@ int _POSIX_Semaphore_Name_to_id( { Objects_Name_to_id_errors status; + if ( !name ) + return EINVAL; + + if ( !name[0] ) + return EINVAL; + status = _Objects_Name_to_id( &_POSIX_Semaphore_Information, (char *)name, 0, id ); if ( status == OBJECTS_SUCCESSFUL ) return 0; - return EINVAL; + return ENOENT; } diff --git a/cpukit/posix/src/semaphorenametoid.c b/cpukit/posix/src/semaphorenametoid.c index c6de93c201..47879402cc 100644 --- a/cpukit/posix/src/semaphorenametoid.c +++ b/cpukit/posix/src/semaphorenametoid.c @@ -31,12 +31,18 @@ int _POSIX_Semaphore_Name_to_id( { Objects_Name_to_id_errors status; + if ( !name ) + return EINVAL; + + if ( !name[0] ) + return EINVAL; + status = _Objects_Name_to_id( &_POSIX_Semaphore_Information, (char *)name, 0, id ); if ( status == OBJECTS_SUCCESSFUL ) return 0; - return EINVAL; + return ENOENT; } -- cgit v1.2.3