Mercurial > dropbear
diff svr-main.c @ 435:337c45621e81
merge of 'a9b0496634cdd25647b65e585cc3240f3fa699ee'
and 'c22be8b8f570b48e9662dac32c7b3e7148a42206'
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 22 Feb 2007 14:53:49 +0000 |
parents | 0aaaf68e97dc c216212001fc |
children | edbee0596531 |
line wrap: on
line diff
--- a/svr-main.c Thu Feb 22 14:52:46 2007 +0000 +++ b/svr-main.c Thu Feb 22 14:53:49 2007 +0000 @@ -28,6 +28,7 @@ #include "buffer.h" #include "signkey.h" #include "runopts.h" +#include "random.h" static size_t listensockets(int *sock, size_t sockcount, int *maxfd); static void sigchld_handler(int dummy); @@ -51,6 +52,8 @@ _dropbear_exit = svr_dropbear_exit; _dropbear_log = svr_dropbear_log; + disallow_core(); + /* get commandline options */ svr_getopts(argc, argv); @@ -122,6 +125,11 @@ int childsock; int childpipe[2]; + /* Note: commonsetup() must happen before we daemon()ise. Otherwise + daemon() will chdir("/"), and we won't be able to find local-dir + hostkeys. */ + commonsetup(); + /* fork */ if (svr_opts.forkbg) { int closefds = 0; @@ -135,8 +143,6 @@ } } - commonsetup(); - /* should be done after syslog is working */ if (svr_opts.forkbg) { dropbear_log(LOG_INFO, "Running in background"); @@ -145,7 +151,7 @@ } /* create a PID file so that we can be killed easily */ - pidfile = fopen(DROPBEAR_PIDFILE, "w"); + pidfile = fopen(svr_opts.pidfile, "w"); if (pidfile) { fprintf(pidfile, "%d\n", getpid()); fclose(pidfile); @@ -188,7 +194,7 @@ val = select(maxsock+1, &fds, NULL, NULL, &seltimeout); if (exitflag) { - unlink(DROPBEAR_PIDFILE); + unlink(svr_opts.pidfile); dropbear_exit("Terminated by signal"); }