mirror of
https://github.com/clearml/dropbear
synced 2025-01-31 10:57:01 +00:00
Patch from Nicolai Ehemann to try binding before going to the background,
so that if it exits early (because something's already listening etc) then it will return an exitcode of 1. --HG-- extra : convert_revision : 4e68851f89a773bc502b30dec2b8f6edaa36d473
This commit is contained in:
parent
b04e2d14ef
commit
762e9973ff
26
svr-main.c
26
svr-main.c
@ -130,6 +130,19 @@ void main_noinetd() {
|
||||
hostkeys. */
|
||||
commonsetup();
|
||||
|
||||
/* sockets to identify pre-authenticated clients */
|
||||
for (i = 0; i < MAX_UNAUTH_CLIENTS; i++) {
|
||||
childpipes[i] = -1;
|
||||
}
|
||||
bzero(preauth_addrs, sizeof(preauth_addrs));
|
||||
|
||||
/* Set up the listening sockets */
|
||||
listensockcount = listensockets(listensocks, MAX_LISTEN_ADDR, &maxsock);
|
||||
if (listensockcount == 0)
|
||||
{
|
||||
dropbear_exit("No listening ports available.");
|
||||
}
|
||||
|
||||
/* fork */
|
||||
if (svr_opts.forkbg) {
|
||||
int closefds = 0;
|
||||
@ -157,19 +170,6 @@ void main_noinetd() {
|
||||
fclose(pidfile);
|
||||
}
|
||||
|
||||
/* sockets to identify pre-authenticated clients */
|
||||
for (i = 0; i < MAX_UNAUTH_CLIENTS; i++) {
|
||||
childpipes[i] = -1;
|
||||
}
|
||||
bzero(preauth_addrs, sizeof(preauth_addrs));
|
||||
|
||||
/* Set up the listening sockets */
|
||||
listensockcount = listensockets(listensocks, MAX_LISTEN_ADDR, &maxsock);
|
||||
if (listensockcount == 0)
|
||||
{
|
||||
dropbear_exit("No listening ports available.");
|
||||
}
|
||||
|
||||
/* incoming connection select loop */
|
||||
for(;;) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user