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
16 #include <stdio.h>
17 #include <signal.h>
18 #include <errno.h>
19 #include <stdint.h>
20 #include "posixtest.h"
21
22 static const int sigs[] = {-1, -10000, INT32_MIN, INT32_MIN + 1};
23
main(void)24 int main(void)
25 {
26 int i, ret, err = 0;
27
28 for (i = 0; i < sizeof(sigs) / sizeof(int); i++) {
29 ret = sighold(sigs[i]);
30
31 if (ret != -1 || errno != EINVAL) {
32 err++;
33 printf("Failed sighold(%i) ret=%i errno=%i\n",
34 sigs[i], ret, errno);
35 }
36 }
37
38 if (err) {
39 printf("Test FAILED\n");
40 return PTS_FAIL;
41 } else {
42 printf("Test PASSED\n");
43 return PTS_PASS;
44 }
45 }
46