-/* $OpenBSD: main.c,v 1.120 2021/03/18 14:05:44 claudio Exp $ */
+/* $OpenBSD: main.c,v 1.121 2021/03/19 09:43:59 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
if (talsz == 0)
err(1, "no TAL files found in %s", "/etc/rpki");
- /* change working directory to the cache directory */
- if (fchdir(cachefd) == -1)
- err(1, "fchdir");
-
/*
* Create the file reader as a jailed child process.
* It will be responsible for reading all of the files (ROAs,
if (procpid == 0) {
close(fd[1]);
+ /* change working directory to the cache directory */
+ if (fchdir(cachefd) == -1)
+ err(1, "fchdir");
+
/* Only allow access to the cache directory. */
if (unveil(".", "r") == -1)
err(1, "%s: unveil", cachedir);
close(proc);
close(fd[1]);
+ /* change working directory to the cache directory */
+ if (fchdir(cachefd) == -1)
+ err(1, "fchdir");
+
if (pledge("stdio rpath proc exec unveil", NULL) == -1)
err(1, "pledge");
for (i = 0; i < talsz; i++)
queue_add_tal(tals[i]);
+ /* change working directory to the cache directory */
+ if (fchdir(cachefd) == -1)
+ err(1, "fchdir");
+
while (entity_queue > 0 && !killme) {
pfd[0].events = POLLIN;
if (rsyncq.queued)