From: Egor Date: Sat, 21 Oct 2023 11:23:56 +0000 (+0300) Subject: use SA_RESTART for SIGINT X-Git-Url: https://git.patchysicp.xyz/?a=commitdiff_plain;h=918805c027e39fe9c2ee1c9f637740a77395112e;p=patchyircd.git use SA_RESTART for SIGINT SA_RESTART specifically doesn't affect polling syscalls (the thing we want to interrupt), but it prevents stupid things like having to check for EINTR on recv/send (which we weren't doing anyway) --- diff --git a/src/main.c b/src/main.c index 16d96a8..739a6f0 100644 --- a/src/main.c +++ b/src/main.c @@ -18,7 +18,8 @@ static void set_handler() struct sigaction sa; sa.sa_handler = on_sigint; sigemptyset(&sa.sa_mask); - sa.sa_flags = SA_RESETHAND; // only run it once + /* Note that SA_RESTART doesn't affect select/poll/epoll_wait. */ + sa.sa_flags = SA_RESETHAND | SA_RESTART; if (sigaction(SIGINT, &sa, NULL) == -1) perror("sigaction"); sa.sa_handler = SIG_IGN;