diff options
author | Omar Polo <op@omarpolo.com> | 2021-06-15 08:06:10 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-06-15 08:06:10 +0000 |
commit | e952c5052a0c524eee6d8151b1af96ce2c94ca18 (patch) | |
tree | 3c665c8c70aea37cf73c6ea38463552a5f6d8ec7 /gmid.c | |
parent | 0f2124e29194b42209e879a539e35d295f525311 (diff) |
allow sending fd to log on to the logger process
the logger process now can receive a file descriptor to write logs
to. At the moment the logic is simple, if it receives a file it logs
there, otherwise it logs to syslog. This will allow to log on custom
log files.
Diffstat (limited to 'gmid.c')
-rw-r--r-- | gmid.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -508,7 +508,11 @@ setup_configless(int argc, char **argv, const char *cgi) loc = xcalloc(1, sizeof(*loc)); TAILQ_INSERT_HEAD(&host->locations, loc, locations); + imsg_compose(&logibuf, IMSG_LOG_TYPE, 0, 0, 2, NULL, 0); + imsg_flush(&logibuf); + serve(argc, argv, NULL); + imsg_compose(&logibuf, IMSG_QUIT, 0, 0, -1, NULL, 0); imsg_flush(&logibuf); } @@ -623,6 +627,11 @@ main(int argc, char **argv) return 0; } + if (conf.foreground) { + imsg_compose(&logibuf, IMSG_LOG_TYPE, 0, 0, 2, NULL, 0); + imsg_flush(&logibuf); + } + pidfd = write_pidfile(pidfile); /* Linux seems to call the event handlers even when we're |