commit 4e2e2ab1d3ac93821434c5e7723ffbcda1b0aee4 from: Omar Polo date: Wed Feb 03 16:37:53 2021 UTC refactor executor_main now it's symmetrical to listener_main(). commit - d672b8fba149427b68a0072c8b28db261833e960 commit + 4e2e2ab1d3ac93821434c5e7723ffbcda1b0aee4 blob - 7696a0210aafc4bd14852e9b5bdd3991c95d3db3 blob + cc1d02de812febf3ecbd74aaf79a51b64638a19d --- ex.c +++ ex.c @@ -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); blob - 319e3f6bb041d761093a480b615daa6e4f85e1a8 blob + bf5bc1633321e786775104be2d5767cb3cee59a2 --- gmid.c +++ gmid.c @@ -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(); } } blob - c0a76500f2f26d5209c7975e98e311f791d5e74b blob + 07f6f1a52fa9307dc49c6622d9206138cbe521b4 --- gmid.h +++ gmid.h @@ -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);