1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
From: =?utf-8?b?0L3QsNCx?= <nabijaczleweli@nabijaczleweli.xyz>
Date: Fri, 22 Aug 2025 00:25:11 +0200
Subject: sigaction(2) is always available
---
hassgact.h.in | 6 ------
meson.build | 6 ------
sig.c | 16 ++--------------
3 files changed, 2 insertions(+), 26 deletions(-)
delete mode 100644 hassgact.h.in
diff --git a/hassgact.h.in b/hassgact.h.in
deleted file mode 100644
index cae2c54..0000000
--- a/hassgact.h.in
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef HASSGACT_H
-#define HASSGACT_H
-
-#define HASSIGACTION @HAVE_SIGACTION@
-
-#endif /* !HASSGACT_H */
diff --git a/meson.build b/meson.build
index bc3dc01..3460386 100644
--- a/meson.build
+++ b/meson.build
@@ -5,12 +5,6 @@ if cc.has_argument('-Wno-misleading-indentation')
add_project_arguments('-Wno-misleading-indentation', language: 'c')
endif
-config = configuration_data()
-config.set10('HAVE_SIGACTION', cc.has_function('sigaction'))
-
-configure_file(configuration: config,
- input: 'hassgact.h.in', output: 'hassgact.h')
-
executable('safecat',
'hostname.c',
'safecat.c',
diff --git a/sig.c b/sig.c
index c27d07e..d474b81 100644
--- a/sig.c
+++ b/sig.c
@@ -1,6 +1,5 @@
/* Copyright (c) 2000, Len Budney. See COPYING for details. */
-#include "hassgact.h"
#include "stralloc.h"
#include "strerr.h"
#include <signal.h>
@@ -15,19 +14,8 @@ static void alarm_handler(int sig) {
/* ****************************************************************** */
-/* ******************************************************************
- This function was pretty much lifted from Qmail code. Thanks to
- Professor Bernstein.
- ****************************************************************** */
+/* ****************************************************************** */
void set_alarm_handler(void) {
-#ifdef HASSIGACTION
- struct sigaction sa;
- sa.sa_handler = alarm_handler;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(sig,&sa,(struct sigaction *) 0);
-#else
- signal(sig,h);
-#endif
+ sigaction(SIGALRM, &(struct sigaction){.sa_handler = alarm_handler}, NULL);
}
/* ****************************************************************** */
|