refactor executor_main

now it's symmetrical to listener_main().
This commit is contained in:
Omar Polo 2021-02-03 16:37:53 +00:00
parent d672b8fba1
commit 4e2e2ab1d3
3 changed files with 13 additions and 12 deletions

20
ex.c
View File

@ -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);

3
gmid.c
View File

@ -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();
}
}

2
gmid.h
View File

@ -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);