mirror of
https://github.com/clearml/dropbear
synced 2025-06-14 18:28:31 +00:00
Add -P pidfile patch from Swen Schillig
--HG-- extra : convert_revision : 2dd1bf9162d8fc4c14b33c5b3c6ca3cbe2ecd587
This commit is contained in:
parent
32af5c267e
commit
4aafeb0da2
@ -83,6 +83,7 @@ typedef struct svr_runopts {
|
|||||||
|
|
||||||
sign_key *hostkey;
|
sign_key *hostkey;
|
||||||
buffer * banner;
|
buffer * banner;
|
||||||
|
char * pidfile;
|
||||||
|
|
||||||
} svr_runopts;
|
} svr_runopts;
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ void main_noinetd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create a PID file so that we can be killed easily */
|
/* create a PID file so that we can be killed easily */
|
||||||
pidfile = fopen(DROPBEAR_PIDFILE, "w");
|
pidfile = fopen(svr_opts.pidfile, "w");
|
||||||
if (pidfile) {
|
if (pidfile) {
|
||||||
fprintf(pidfile, "%d\n", getpid());
|
fprintf(pidfile, "%d\n", getpid());
|
||||||
fclose(pidfile);
|
fclose(pidfile);
|
||||||
@ -189,7 +189,7 @@ void main_noinetd() {
|
|||||||
val = select(maxsock+1, &fds, NULL, NULL, &seltimeout);
|
val = select(maxsock+1, &fds, NULL, NULL, &seltimeout);
|
||||||
|
|
||||||
if (exitflag) {
|
if (exitflag) {
|
||||||
unlink(DROPBEAR_PIDFILE);
|
unlink(svr_opts.pidfile);
|
||||||
dropbear_exit("Terminated by signal");
|
dropbear_exit("Terminated by signal");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,8 @@ static void printhelp(const char * progname) {
|
|||||||
#endif
|
#endif
|
||||||
"-p port Listen on specified tcp port, up to %d can be specified\n"
|
"-p port Listen on specified tcp port, up to %d can be specified\n"
|
||||||
" (default %s if none specified)\n"
|
" (default %s if none specified)\n"
|
||||||
|
"-P PidFile Create pid file PidFile\n"
|
||||||
|
" (default %s)\n"
|
||||||
#ifdef INETD_MODE
|
#ifdef INETD_MODE
|
||||||
"-i Start for inetd\n"
|
"-i Start for inetd\n"
|
||||||
#endif
|
#endif
|
||||||
@ -85,7 +87,7 @@ static void printhelp(const char * progname) {
|
|||||||
#ifdef DROPBEAR_RSA
|
#ifdef DROPBEAR_RSA
|
||||||
RSA_PRIV_FILENAME,
|
RSA_PRIV_FILENAME,
|
||||||
#endif
|
#endif
|
||||||
DROPBEAR_MAX_PORTS, DROPBEAR_DEFPORT);
|
DROPBEAR_MAX_PORTS, DROPBEAR_DEFPORT, DROPBEAR_PIDFILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void svr_getopts(int argc, char ** argv) {
|
void svr_getopts(int argc, char ** argv) {
|
||||||
@ -105,6 +107,7 @@ void svr_getopts(int argc, char ** argv) {
|
|||||||
svr_opts.inetdmode = 0;
|
svr_opts.inetdmode = 0;
|
||||||
svr_opts.portcount = 0;
|
svr_opts.portcount = 0;
|
||||||
svr_opts.hostkey = NULL;
|
svr_opts.hostkey = NULL;
|
||||||
|
svr_opts.pidfile = DROPBEAR_PIDFILE;
|
||||||
#ifdef ENABLE_SVR_LOCALTCPFWD
|
#ifdef ENABLE_SVR_LOCALTCPFWD
|
||||||
svr_opts.nolocaltcp = 0;
|
svr_opts.nolocaltcp = 0;
|
||||||
#endif
|
#endif
|
||||||
@ -185,6 +188,9 @@ void svr_getopts(int argc, char ** argv) {
|
|||||||
svr_opts.portcount++;
|
svr_opts.portcount++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'P':
|
||||||
|
next = &svr_opts.pidfile;
|
||||||
|
break;
|
||||||
#ifdef DO_MOTD
|
#ifdef DO_MOTD
|
||||||
/* motd is displayed by default, -m turns it off */
|
/* motd is displayed by default, -m turns it off */
|
||||||
case 'm':
|
case 'm':
|
||||||
|
Loading…
Reference in New Issue
Block a user