1 /* 2 Copyright (c) 2003, Intel Corporation. All rights reserved. 3 Created by: majid.awad REMOVE-THIS AT intel DOT com 4 This file is licensed under the GPL license. For the full content 5 of this license, see the COPYING file at the top level of this 6 source tree. 7 */ 8 9 /* 10 * Trying to unlink a semaphore which it doesn't exist. It give an ERROR: 11 * ENOENT. 12 */ 13 14 #include <stdio.h> 15 #include <errno.h> 16 #include <unistd.h> 17 #include <semaphore.h> 18 #include <sys/stat.h> 19 #include <fcntl.h> 20 #include "posixtest.h" 21 22 #define TEST "4-1" 23 #define FUNCTION "sem_unlink" 24 #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " 25 26 int main(void) 27 { 28 29 char semname[28]; 30 31 sem_unlink(semname); 32 33 if (errno == ENOENT) { 34 puts("TEST PASSED"); 35 return PTS_PASS; 36 } else { 37 puts("TEST FAILED: semaphore does exist"); 38 return PTS_FAIL; 39 } 40 } 41