commit 3493f11e1a9dd1da0ec008dac90dbac9d5c384f9
parent a3383c0a431f7c49a24854dc9595e192d870e851
Author: hhvn <dev@hhvn.uk>
Date: Thu, 17 Jun 2021 17:30:36 +0100
mitmd.c: handle fork error
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/mitmd.c b/mitmd.c
@@ -114,6 +114,9 @@ mitm(int client, char *host, char *port) {
}
switch (pid = fork()) {
+ case -1:
+ dprintf(client, "fork(): %s\n", errno);
+ break;
case 0:
while (read_line(client, bufc, sizeof(bufc)) != 0) {
printf("%03d%s%03d %s", client, CLIENT_STYLE, remote, bufc);
@@ -125,8 +128,6 @@ mitm(int client, char *host, char *port) {
printf("%03d%s%03d %s", client, REMOTE_STYLE, remote, bufr);
write(client, bufr, strlen(bufr));
}
- case -1:
- break;
}
cleanup: