most recent updates to sigset-5 and 10
This commit is contained in:
+15
-10
@@ -4,18 +4,23 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "../test_helpers.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
if (sigset(SIGKILL,SIG_IGN) == SIG_ERR) {
|
||||
if (errno != EINVAL) {
|
||||
printf("Test FAILED: sigset() returned SIG_ERR but didn't set errno to EINVAL\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
printf("Test FAILED: sigset() didn't return SIG_ERROR even though SIGKILL was passed to it\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("test passed: error was set successfully\n");
|
||||
void (*status) (int);
|
||||
status = sigset(SIGKILL,SIG_IGN);
|
||||
ERROR_IF(sigset, status, == SIG_ERR);
|
||||
ERROR_IF(sigset, errno, != EINVAL);
|
||||
// if (sigset(SIGKILL,SIG_IGN) == SIG_ERR) {
|
||||
// if (errno != EINVAL) {
|
||||
// printf("Test FAILED: sigset() returned SIG_ERR but didn't set errno to EINVAL\n");
|
||||
// exit(EXIT_FAILURE);
|
||||
// }
|
||||
// } else {
|
||||
// printf("Test FAILED: sigset() didn't return SIG_ERROR even though SIGKILL was passed to it\n");
|
||||
// exit(EXIT_FAILURE);
|
||||
// }
|
||||
// printf("test passed: error was set successfully\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+15
-10
@@ -36,20 +36,25 @@ int sigset_test5(int signum)
|
||||
sigemptyset(&mask);
|
||||
|
||||
sigprocmask(SIG_SETMASK, &mask, NULL);
|
||||
void (*status) (int);
|
||||
|
||||
if (sigset(signum, sig_handler) == SIG_ERR) {
|
||||
perror("Unexpected error while using sigset()");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
status = sigset(signum, sig_handler);
|
||||
ERROR_IF(sigset, status, == SIG_ERR);
|
||||
// if (sigset(signum, sig_handler) == SIG_ERR) {
|
||||
// perror("Unexpected error while using sigset()");
|
||||
// exit(EXIT_FAILURE);
|
||||
// }
|
||||
|
||||
raise(signum);
|
||||
sigprocmask(SIG_SETMASK, NULL, &mask);
|
||||
|
||||
if (is_empty(&mask) != 1) {
|
||||
printf("Test FAILED: signal mask should be empty\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("sig %d was successfully removed from the mask when handler returned\n", signum);
|
||||
int status1;
|
||||
status1 = is_empty(&mask);
|
||||
ERROR_IF(is_empty, status1, != 1);
|
||||
// if (is_empty(&mask) != 1) {
|
||||
// printf("Test FAILED: signal mask should be empty\n");
|
||||
// exit(EXIT_FAILURE);
|
||||
// }
|
||||
// printf("sig %d was successfully removed from the mask when handler returned\n", signum);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user