mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
laminard: ignore SIGHUP
Many daemons reload config file on SIGHUP; laminar don't have config file, so signal is ignored (with informative message on stdout). Previously, default handler for SIGHUP was used that terminates process. Closes: #166
This commit is contained in:
parent
261c08d2fe
commit
99e2e62906
@ -26,6 +26,7 @@
|
||||
#include <kj/async-unix.h>
|
||||
#include <kj/filesystem.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
@ -53,6 +54,13 @@ static void usage(std::ostream& out) {
|
||||
out << " -v enable verbose output\n";
|
||||
}
|
||||
|
||||
static void on_sighup(int)
|
||||
{
|
||||
constexpr const char msg[] = "Laminar received and ignored SIGHUP\n";
|
||||
// write(2) is safe to call inside signal handler.
|
||||
write(STDERR_FILENO, msg, sizeof(msg) - 1);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if(argv[0][0] == '{')
|
||||
return leader_main();
|
||||
@ -92,6 +100,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
signal(SIGINT, &laminar_quit);
|
||||
signal(SIGTERM, &laminar_quit);
|
||||
signal(SIGHUP, &on_sighup);
|
||||
|
||||
printf("laminard version %s started\n", laminar_version());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user