diff options
author | Omar Polo <op@omarpolo.com> | 2021-02-03 16:37:53 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-02-03 16:37:53 +0000 |
commit | 4e2e2ab1d3ac93821434c5e7723ffbcda1b0aee4 (patch) | |
tree | 9928c59d10211b70327791bb9949cb1f6bd7c273 | |
parent | d672b8fba149427b68a0072c8b28db261833e960 (diff) |
refactor executor_main
now it's symmetrical to listener_main().
-rw-r--r-- | ex.c | 20 | ||||
-rw-r--r-- | gmid.c | 3 | ||||
-rw-r--r-- | gmid.h | 2 |
3 files changed, 13 insertions, 12 deletions
@@ -330,7 +330,7 @@ childerr: } int -executor_main(int fd) +executor_main() { char *spath, *relpath, *addr, *ruser, *cissuer, *chash; struct vhost *vhost; @@ -351,19 +351,19 @@ executor_main(int fd) #endif for (;;) { - if (!recv_iri(fd, &iri) - || !recv_string(fd, &spath) - || !recv_string(fd, &relpath) - || !recv_string(fd, &addr) - || !recv_string(fd, &ruser) - || !recv_string(fd, &cissuer) - || !recv_string(fd, &chash) - || !recv_vhost(fd, &vhost)) + if (!recv_iri(exfd, &iri) + || !recv_string(exfd, &spath) + || !recv_string(exfd, &relpath) + || !recv_string(exfd, &addr) + || !recv_string(exfd, &ruser) + || !recv_string(exfd, &cissuer) + || !recv_string(exfd, &chash) + || !recv_vhost(exfd, &vhost)) break; d = launch_cgi(&iri, spath, relpath, addr, ruser, cissuer, chash, vhost); - if (!send_fd(fd, d)) + if (!send_fd(exfd, d)) break; close(d); @@ -504,8 +504,9 @@ serve(int argc, char **argv, int *p) close(p[1]); p[1] = -1; } + exfd = p[0]; drop_priv(); - return executor_main(p[0]); + return executor_main(); } } @@ -232,7 +232,7 @@ int send_vhost(int, struct vhost*); int recv_vhost(int, struct vhost**); int send_fd(int, int); int recv_fd(int); -int executor_main(int); +int executor_main(void); /* sandbox.c */ void sandbox(void); |