Merge pull request #167 from HighwindsHipsApp/master

Fixed parent/child usage after initial fork in sslh-fork.c
This commit is contained in:
yrutschle 2018-02-11 18:42:21 +01:00 committed by GitHub
commit 3a61c8b0b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,11 +150,11 @@ void main_loop(int listen_sockets[], int num_addr_listen)
for (i = 0; i < num_addr_listen; i++) {
listener_pid[i] = fork();
switch(listener_pid[i]) {
case 0: break;
// Log if fork() fails for some reason
case -1: log_message(LOG_ERR, "fork failed: err %d: %s\n", errno, strerror(errno));
break;
default:
// We're in the child, we have work to do
case 0:
/* Listening process just accepts a connection, forks, and goes
* back to listening */
while (1)
@ -178,6 +178,10 @@ void main_loop(int listen_sockets[], int num_addr_listen)
}
close(in_socket);
}
break;
// We're in the parent, we don't need to do anything
default:
break;
}
}