comparison cli-main.c @ 1216:3daff2072bd0

rename killchild to kill_proxy_sighandler
author Matt Johnston <matt@ucc.asn.au>
date Tue, 15 Dec 2015 22:15:44 +0800
parents d058e15ea213
children f7d565054e5f
comparison
equal deleted inserted replaced
1215:d058e15ea213 1216:3daff2072bd0
35 static void cli_dropbear_exit(int exitcode, const char* format, va_list param) ATTRIB_NORETURN; 35 static void cli_dropbear_exit(int exitcode, const char* format, va_list param) ATTRIB_NORETURN;
36 static void cli_dropbear_log(int priority, const char* format, va_list param); 36 static void cli_dropbear_log(int priority, const char* format, va_list param);
37 37
38 #ifdef ENABLE_CLI_PROXYCMD 38 #ifdef ENABLE_CLI_PROXYCMD
39 static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out); 39 static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out);
40 static void killchild(int signo); 40 static void kill_proxy_sighandler(int signo);
41 #endif 41 #endif
42 42
43 #if defined(DBMULTI_dbclient) || !defined(DROPBEAR_MULTI) 43 #if defined(DBMULTI_dbclient) || !defined(DROPBEAR_MULTI)
44 #if defined(DBMULTI_dbclient) && defined(DROPBEAR_MULTI) 44 #if defined(DBMULTI_dbclient) && defined(DROPBEAR_MULTI)
45 int cli_main(int argc, char ** argv) { 45 int cli_main(int argc, char ** argv) {
76 pid_t proxy_cmd_pid = 0; 76 pid_t proxy_cmd_pid = 0;
77 #ifdef ENABLE_CLI_PROXYCMD 77 #ifdef ENABLE_CLI_PROXYCMD
78 if (cli_opts.proxycmd) { 78 if (cli_opts.proxycmd) {
79 cli_proxy_cmd(&sock_in, &sock_out, &proxy_cmd_pid); 79 cli_proxy_cmd(&sock_in, &sock_out, &proxy_cmd_pid);
80 m_free(cli_opts.proxycmd); 80 m_free(cli_opts.proxycmd);
81 if (signal(SIGINT, killchild) == SIG_ERR || 81 if (signal(SIGINT, kill_proxy_sighandler) == SIG_ERR ||
82 signal(SIGTERM, killchild) == SIG_ERR || 82 signal(SIGTERM, kill_proxy_sighandler) == SIG_ERR ||
83 signal(SIGHUP, killchild) == SIG_ERR) { 83 signal(SIGHUP, kill_proxy_sighandler) == SIG_ERR) {
84 dropbear_exit("signal() error"); 84 dropbear_exit("signal() error");
85 } 85 }
86 } else 86 } else
87 #endif 87 #endif
88 { 88 {
162 dropbear_exit("Failed running proxy command"); 162 dropbear_exit("Failed running proxy command");
163 *sock_in = *sock_out = -1; 163 *sock_in = *sock_out = -1;
164 } 164 }
165 } 165 }
166 166
167 static void killchild(int signo) { 167 static void kill_proxy_sighandler(int UNUSED(signo)) {
168 kill_proxy_command(); 168 kill_proxy_command();
169 if (signo) { 169 _exit(1);
170 _exit(1);
171 }
172 exit(1);
173 } 170 }
174 #endif /* ENABLE_CLI_PROXYCMD */ 171 #endif /* ENABLE_CLI_PROXYCMD */