about summary refs log tree commit diff
path: root/sandman.m
diff options
context:
space:
mode:
Diffstat (limited to 'sandman.m')
-rw-r--r--sandman.m13
1 files changed, 10 insertions, 3 deletions
diff --git a/sandman.m b/sandman.m
index 7d2f56a..44ab267 100644
--- a/sandman.m
+++ b/sandman.m
@@ -21,11 +21,11 @@
 #import <sysexits.h>
 #import <unistd.h>
 
-void sigchld(int sig) {
+void handler(int sig) {
 	(void)sig;
 	int status;
 	pid_t pid = wait(&status);
-	if (pid < 0) err(EX_OSERR, "wait");
+	if (pid < 0) _exit(EX_OSERR);
 	if (WIFSIGNALED(status)) {
 		_exit(128 + WTERMSIG(status));
 	} else {
@@ -36,7 +36,14 @@ void sigchld(int sig) {
 int main(int argc, char *argv[]) {
 	if (argc < 2) return EX_USAGE;
 
-	signal(SIGCHLD, sigchld);
+	sigset_t mask;
+	sigemptyset(&mask);
+	struct sigaction sa = {
+		.sa_handler = handler,
+		.sa_mask = mask,
+		.sa_flags = SA_RESTART,
+	};
+	sigaction(SIGCHLD, &sa, NULL);
 
 	pid_t pid = fork();
 	if (pid < 0) err(EX_OSERR, "fork");
s='logmsg'> 2021-04-26Update to Linux man-pages 5.11June McEnroe 2021-04-26Update to FreeBSD 13.0June McEnroe 2021-01-27Completely rewrite how manuals are fetched and installedJune McEnroe Also add section 6 manuals from NetBSD and OpenBSD! 2020-12-14Update to man-pages-posix 2017-aJune McEnroe 2020-12-14Update to OpenBSD 6.8June McEnroe 2020-12-14Update to NetBSD 9.1June McEnroe 2020-12-14Update to man-pages 5.09June McEnroe 2020-12-14Update to FreeBSD 12.2June McEnroe 2020-06-08Update to OpenBSD 6.7June McEnroe 2020-05-04Add hack for macOS to search extra man sectionsJune McEnroe 2020-05-04Don't clear MANSECTJune McEnroe