1 /*
2  * Copyright (c) 2003, Intel Corporation. All rights reserved.
3  * Copyright (c) 2013, Cyril Hrubis <chrubis@suse.cz>
4  *
5  * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
6  * This file is licensed under the GPL license.  For the full content
7  * of this license, see the COPYING file at the top level of this
8  * source tree.
9  *
10  *
11  * After sighold is called on an invalid signal it should return -1 and set
12  * errno to EINVAL
13  */
14 
15 #define _XOPEN_SOURCE 600
16 
17 #include <stdio.h>
18 #include <signal.h>
19 #include <errno.h>
20 #include <stdint.h>
21 #include "posixtest.h"
22 
23 static const int sigs[] = {-1, -10000, INT32_MIN, INT32_MIN + 1};
24 
main(void)25 int main(void)
26 {
27 	int i, ret, err = 0;
28 
29 	for (i = 0; i < sizeof(sigs) / sizeof(int); i++) {
30 		ret = sighold(sigs[i]);
31 
32 		if (ret != -1 || errno != EINVAL) {
33 			err++;
34 			printf("Failed sighold(%i) ret=%i errno=%i\n",
35 			       sigs[i], ret, errno);
36 		}
37 	}
38 
39 	if (err) {
40 		printf("Test FAILED\n");
41 		return PTS_FAIL;
42 	} else {
43 		printf("Test PASSED\n");
44 		return PTS_PASS;
45 	}
46 }
47