aboutsummaryrefslogtreecommitdiff
path: root/gmid.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2023-07-24 08:50:49 +0000
committerOmar Polo <op@omarpolo.com>2023-07-24 08:50:49 +0000
commit226f13ece0b309abeee0ae8a4d8c9f049fe896a7 (patch)
treebb0d3efb3ff5064a04335eca0d615444f7696655 /gmid.c
parent3826d7de43d3b9078c5e18e0074799a3a9ee682e (diff)
add ability to log to files with log access <path>
Diffstat (limited to 'gmid.c')
-rw-r--r--gmid.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gmid.c b/gmid.c
index 663de42..6a7132c 100644
--- a/gmid.c
+++ b/gmid.c
@@ -320,6 +320,16 @@ static int
main_configure(struct conf *conf)
{
struct privsep *ps = conf->ps;
+ int fd = -1;
+
+ if (!debug) {
+ if (conf->log_access && (fd = open(conf->log_access,
+ O_WRONLY|O_CREAT|O_APPEND, 0600)) == -1)
+ log_warn("can't open %s", conf->log_access);
+ if (proc_compose_imsg(ps, PROC_LOGGER, -1, IMSG_LOG_TYPE,
+ -1, fd, NULL, 0) == -1)
+ return -1;
+ }
conf->reload = conf->prefork + 1; /* servers, crypto */