[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

sem_close doesn't report EINVAL ERROR on invalid semaphore

I'm new to this list, and I will be reporting bugs to this list as I wrote
the conformance Semaphore posix test suite.  You can get the latest release
from: http://posixtest.sourceforge.net/ 

Bug description:  sem_close reports SUCCESS on closing invalid semaphore.

Expected result:  sem_close function shall fail if the sem argument is not a
valid semaphore descriptor.

NPTL Version:  0.24
GLIBC Version: glibc-2.3.1
Kernel Version: 2.5.59

Test Case:

#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <semaphore.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "posixtest.h"

#define TEST "4-1"
#define FUNCTION "sem_close"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "

int main()
        sem_t   *mysemp;
        char semname[20];

        mysemp = NULL;
        sprintf(semname,  FUNCTION "_" TEST "_%d", getpid());


        if ( errno == EINVAL )  {
                puts("TEST PASSED");
                return PTS_PASS;
        } else {
                perror("Error: ");
                puts("TEST FAILED");
                return PTS_FAIL;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]