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 sigset shall return the signal's
9  previous disposition if signal had not been blocked.
10 
11 */
12 
13 
14 #include <signal.h>
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include "posixtest.h"
18 
myhandler(int signo)19 void myhandler(int signo)
20 {
21 	printf("SIGUSR1 called. Inside handler\n");
22 }
23 
main(void)24 int main(void)
25 {
26 	struct sigaction act;
27 	act.sa_flags = 0;
28 	act.sa_handler = myhandler;
29 	sigemptyset(&act.sa_mask);
30 
31 	if (sigaction(SIGUSR1, &act, 0) != 0) {
32 		perror("Unexpected error while using sigaction()");
33 		return PTS_UNRESOLVED;
34 	}
35 
36 	if (sigset(SIGUSR1, SIG_DFL) != myhandler) {
37 		printf
38 		    ("Test FAILED: sigset didn't return myhandler even though it was SIGUSR1's original disposition\n");
39 		return PTS_FAIL;
40 	}
41 
42 	return PTS_PASS;
43 }
44