0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Flock: a bit more fd closing

This commit is contained in:
Maria Matejka 2024-10-02 19:23:24 +02:00
parent fb10346860
commit 77e21c6b7d

View File

@ -209,17 +209,16 @@ container_mainloop(int fd)
SYSCALL(fchdir, wfd);
close(wfd); wfd = -1;
int ufd = GETDIR(lp_strdup(lp, "./upper"));
close(GETDIR(lp_strdup(lp, "./upper")));
close(GETDIR(lp_strdup(lp, "./tmp")));
close(GETDIR(lp_strdup(lp, "./root")));
int lfd = -1;
bool cloneroot = !strcmp(ccf.basedir, "/");
bool clonedev = cloneroot;
if (cloneroot)
{
ccf.basedir = "./lower";
lfd = GETDIR(lp_strdup(lp, "./lower"));
close(GETDIR(lp_strdup(lp, "./lower")));
}
const char *overlay_mount_options = lp_sprintf(lp, "lowerdir=%s,upperdir=%s,workdir=%s",
@ -321,6 +320,7 @@ container_mainloop(int fd)
pid_t logger_pid = fork();
if (!logger_pid)
{
/* TODO: this HAS to run as birdloop */
MKDIR("/var/log");
int wfd = SYSCALL(open, "/var/log/syslog", O_WRONLY | O_CREAT, 0640);