Fix sigset-5 and sigset-10.

This commit is contained in:
4lDO2
2025-04-17 12:04:35 +02:00
parent cb23a518c0
commit d1081b278c
2 changed files with 14 additions and 11 deletions
+4 -3
View File
@@ -1,5 +1,6 @@
#define _XOPEN_SOURCE 600
#include <assert.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -10,8 +11,8 @@ int main()
{
void (*status) (int);
status = sigset(SIGKILL,SIG_IGN);
ERROR_IF(sigset, status, == SIG_ERR);
ERROR_IF(sigset, errno, != EINVAL);
assert(status == SIG_ERR);
assert(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");
@@ -23,4 +24,4 @@ int main()
// }
// printf("test passed: error was set successfully\n");
return EXIT_SUCCESS;
}
}
+10 -8
View File
@@ -1,6 +1,8 @@
#define _XOPEN_SOURCE 600
#include <assert.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "signals_list.h"
@@ -8,21 +10,21 @@
#define NUMSIGNALS 26
int is_empty(sigset_t *set) {
bool is_empty(sigset_t *set) {
int i;
int siglist[] = {SIGABRT, SIGALRM, SIGBUS, SIGCHLD,
int siglist[25] = {SIGABRT, SIGALRM, SIGBUS, SIGCHLD,
SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT,
SIGPIPE, SIGQUIT, SIGSEGV,
SIGTERM, SIGTSTP, SIGTTIN, SIGTTOU,
SIGUSR1, SIGUSR2, SIGPROF, SIGSYS,
SIGTRAP, SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ };
for (i=0; i<NUMSIGNALS; i++) {
for (i=0; i<25; i++) {
if (sigismember(set, siglist[i]) != 0)
return 0;
return false;
}
return 1;
return true;
}
void sig_handler(int signo)
@@ -47,9 +49,8 @@ int sigset_test5(int signum)
raise(signum);
sigprocmask(SIG_SETMASK, NULL, &mask);
int status1;
status1 = is_empty(&mask);
ERROR_IF(is_empty, status1, != 1);
bool status1 = is_empty(&mask);
assert(status1);
// if (is_empty(&mask) != 1) {
// printf("Test FAILED: signal mask should be empty\n");
// exit(EXIT_FAILURE);
@@ -60,6 +61,7 @@ int sigset_test5(int signum)
int main(){
for (int i=1; i<N_SIGNALS; i++){
printf("Testing for sig %s (%d)\n", strsignal(i), i);
if (i == SIGKILL || i == SIGSTOP){
continue;
}