Mercurial > dropbear
changeset 447:278805938dcf
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.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 19 Jul 2007 15:54:18 +0000 |
parents | 2cd2edfa11ee |
children | 9c61e7af0156 |
files | svr-main.c |
diffstat | 1 files changed, 13 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/svr-main.c Thu Jul 19 15:47:32 2007 +0000 +++ b/svr-main.c Thu Jul 19 15:54:18 2007 +0000 @@ -130,6 +130,19 @@ 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 @@ 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(;;) {