aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-02-03 16:37:53 +0000
committerOmar Polo <op@omarpolo.com>2021-02-03 16:37:53 +0000
commit4e2e2ab1d3ac93821434c5e7723ffbcda1b0aee4 (patch)
tree9928c59d10211b70327791bb9949cb1f6bd7c273
parentd672b8fba149427b68a0072c8b28db261833e960 (diff)
refactor executor_main
now it's symmetrical to listener_main().
-rw-r--r--ex.c20
-rw-r--r--gmid.c3
-rw-r--r--gmid.h2
3 files changed, 13 insertions, 12 deletions
diff --git a/ex.c b/ex.c
index 7696a02..cc1d02d 100644
--- a/ex.c
+++ b/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);
diff --git a/gmid.c b/gmid.c
index 319e3f6..bf5bc16 100644
--- a/gmid.c
+++ b/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();
}
}
diff --git a/gmid.h b/gmid.h
index c0a7650..07f6f1a 100644
--- a/gmid.h
+++ b/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);