diff options
author | Omar Polo <op@omarpolo.com> | 2021-03-31 16:32:18 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-03-31 16:32:18 +0000 |
commit | b8e64ccd44290cdd34bdcd3fd85fb1a9cb7486dd (patch) | |
tree | 0e419f355bb2bda7a099fd1c113e1c04f7dfe723 /sandbox.c | |
parent | e0ebdf2d94159db669a67972b760d1920f11310b (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.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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 */ |