mirror of https://github.com/omar-polo/gmid.git
open the log files inside the chroot
This commit is contained in:
parent
3bda540e34
commit
4acf495f41
12
gmid.c
12
gmid.c
|
@ -322,16 +322,26 @@ static int
|
||||||
main_send_logfd(struct conf *conf)
|
main_send_logfd(struct conf *conf)
|
||||||
{
|
{
|
||||||
struct privsep *ps = conf->ps;
|
struct privsep *ps = conf->ps;
|
||||||
int fd = -1;
|
char path[PATH_MAX];
|
||||||
|
int r, fd = -1;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (conf->log_access) {
|
if (conf->log_access) {
|
||||||
|
r = snprintf(path, sizeof(path), "%s%s%s", conf->chroot,
|
||||||
|
*conf->chroot == '\0' ? "" : "/", conf->log_access);
|
||||||
|
if (r < 0 || (size_t)r >= sizeof(path)) {
|
||||||
|
log_warnx("path too long: %s", conf->log_access);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
fd = open(conf->log_access, O_WRONLY|O_CREAT|O_APPEND, 0600);
|
fd = open(conf->log_access, O_WRONLY|O_CREAT|O_APPEND, 0600);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
log_warn("can't open %s", conf->log_access);
|
log_warn("can't open %s", conf->log_access);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
if (proc_compose_imsg(ps, PROC_LOGGER, -1, IMSG_LOG_TYPE, -1, fd,
|
if (proc_compose_imsg(ps, PROC_LOGGER, -1, IMSG_LOG_TYPE, -1, fd,
|
||||||
NULL, 0) == -1)
|
NULL, 0) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -140,6 +140,8 @@ This is the default behaviour.
|
||||||
.It Ic access Ar file
|
.It Ic access Ar file
|
||||||
Log the requests to
|
Log the requests to
|
||||||
.Ar file .
|
.Ar file .
|
||||||
|
The path is relative to the
|
||||||
|
.Ic chroot .
|
||||||
.El
|
.El
|
||||||
.It Ic prefork Ar number
|
.It Ic prefork Ar number
|
||||||
Run the specified number of server processes.
|
Run the specified number of server processes.
|
||||||
|
|
Loading…
Reference in New Issue