aboutsummaryrefslogtreecommitdiff
path: root/sandbox.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-03-31 16:32:18 +0000
committerOmar Polo <op@omarpolo.com>2021-03-31 16:32:18 +0000
commitb8e64ccd44290cdd34bdcd3fd85fb1a9cb7486dd (patch)
tree0e419f355bb2bda7a099fd1c113e1c04f7dfe723 /sandbox.c
parente0ebdf2d94159db669a67972b760d1920f11310b (diff)
list instead of fixed-size array for vhosts and locations
saves some bytes of memory and removes the limit on the maximum number of vhosts and location blocks.
Diffstat (limited to 'sandbox.c')
-rw-r--r--sandbox.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sandbox.c b/sandbox.c
index 1a0dc9a..b689a27 100644
--- a/sandbox.c
+++ b/sandbox.c
@@ -282,7 +282,7 @@ sandbox_server_process(void)
{
struct vhost *h;
- for (h = hosts; h->domain != NULL; ++h) {
+ TAILQ_FOREACH(h, &hosts, vhosts) {
if (unveil(h->dir, "r") == -1)
fatal("unveil %s for domain %s", h->dir, h->domain);
}
@@ -294,13 +294,13 @@ sandbox_server_process(void)
void
sandbox_executor_process(void)
{
- struct vhost *vhost;
+ struct vhost *h;
- for (vhost = hosts; vhost->domain != NULL; ++vhost) {
+ TAILQ_FOREACH(h, &hosts, vhosts) {
/* r so we can chdir into the correct directory */
- if (unveil(vhost->dir, "rx") == -1)
+ if (unveil(h->dir, "rx") == -1)
err(1, "unveil %s for domain %s",
- vhost->dir, vhost->domain);
+ h->dir, h->domain);
}
/* rpath to chdir into the correct directory */