• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
myhandler(int signo)20 void myhandler(int signo)
21 {
22 	printf("handler does nothing useful.\n");
23 }
24 
main(void)25 int main(void)
26 {
27 	errno = -1;
28 
29 	if (signal(-1, myhandler) != SIG_ERR) {
30 		printf
31 		    ("Test FAILED: signal() didn't return SIG_ERR even though invalid signal number was passed to it\n");
32 		return PTS_FAIL;
33 	}
34 
35 	if (errno <= 0) {
36 		printf
37 		    ("Test FAILED: errno wasn't set to a positive number even though invalid signal number was passed to the signal() function\n");
38 		return PTS_FAIL;
39 	}
40 	return PTS_PASS;
41 }
42