1/*
2 * Copyright (c) 2003, Intel Corporation. All rights reserved.
3 * Created by:  salwan.searty 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 This program tests the assertion that signal() shall return SIG_ERR
9 and set errno to a positive value if an invalid signal number was
10 passed to it.
11
12*/
13
14#include <signal.h>
15#include <stdio.h>
16#include <stdlib.h>
17#include <errno.h>
18#include "posixtest.h"
19
20void myhandler(int signo)
21{
22	printf("handler does nothing useful.\n");
23}
24
25int main()
26{
27	errno = -1;
28
29	if (signal(-1, myhandler) != SIG_ERR) {
30                printf("Test FAILED: signal() didn't return SIG_ERR even though invalid signal number was passed to it\n");
31               	return PTS_FAIL;
32        }
33
34	if (errno <= 0) {
35		printf("Test FAILED: errno wasn't set to a positive number even though invalid signal number was passed to the signal() function\n");
36               	return PTS_FAIL;
37        }
38	return PTS_PASS;
39}
40