A few minor style fixes

This commit is contained in:
Matt Johnston 2015-12-15 22:09:55 +08:00
parent 3d33e65a35
commit 79b43270a7
5 changed files with 18 additions and 15 deletions

View File

@ -164,11 +164,11 @@ static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out) {
} }
} }
static void killchild(int signo) static void killchild(int signo) {
{
kill_proxy_command(); kill_proxy_command();
if (signo) if (signo) {
_exit(1); _exit(1);
}
exit(1); exit(1);
} }
#endif /* ENABLE_CLI_PROXYCMD */ #endif /* ENABLE_CLI_PROXYCMD */

View File

@ -828,17 +828,20 @@ static int match_extendedopt(const char** strptr, const char *optname) {
int optlen = strlen(optname); int optlen = strlen(optname);
const char *str = *strptr; const char *str = *strptr;
while (isspace(*str)) while (isspace(*str)) {
++str; ++str;
}
if (strncasecmp(str, optname, optlen) != 0) if (strncasecmp(str, optname, optlen) != 0) {
return DROPBEAR_FAILURE; return DROPBEAR_FAILURE;
}
str += optlen; str += optlen;
while (isspace(*str) || (!seen_eq && *str == '=')) { while (isspace(*str) || (!seen_eq && *str == '=')) {
if (*str == '=') if (*str == '=') {
seen_eq = 1; seen_eq = 1;
}
++str; ++str;
} }
@ -846,12 +849,12 @@ static int match_extendedopt(const char** strptr, const char *optname) {
return DROPBEAR_SUCCESS; return DROPBEAR_SUCCESS;
} }
static int parse_flag_value(const char *value) static int parse_flag_value(const char *value) {
{ if (strcmp(value, "yes") == 0 || strcmp(value, "true") == 0) {
if (strcmp(value, "yes") == 0 || strcmp(value, "true") == 0)
return 1; return 1;
else if (strcmp(value, "no") == 0 || strcmp(value, "false") == 0) } else if (strcmp(value, "no") == 0 || strcmp(value, "false") == 0) {
return 0; return 0;
}
dropbear_exit("Bad yes/no argument '%s'", value); dropbear_exit("Bad yes/no argument '%s'", value);
} }

View File

@ -67,10 +67,11 @@ void fwd_failed(const char* format, ...)
va_list param; va_list param;
va_start(param, format); va_start(param, format);
if (cli_opts.exit_on_fwd_failure) if (cli_opts.exit_on_fwd_failure) {
_dropbear_exit(EXIT_FAILURE, format, param); _dropbear_exit(EXIT_FAILURE, format, param);
else } else {
_dropbear_log(LOG_WARNING, format, param); _dropbear_log(LOG_WARNING, format, param);
}
va_end(param); va_end(param);
} }

View File

@ -305,7 +305,7 @@ struct clientsession {
struct AgentkeyList *agentkeys; /* Keys to use for public-key auth */ struct AgentkeyList *agentkeys; /* Keys to use for public-key auth */
#endif #endif
int proxy_cmd_pid; pid_t proxy_cmd_pid;
}; };
/* Global structs storing the state */ /* Global structs storing the state */

View File

@ -215,8 +215,7 @@ void svr_dropbear_log(int priority, const char* format, va_list param) {
havetrace = debug_trace; havetrace = debug_trace;
#endif #endif
if (!opts.usingsyslog || havetrace) if (!opts.usingsyslog || havetrace) {
{
struct tm * local_tm = NULL; struct tm * local_tm = NULL;
timesec = time(NULL); timesec = time(NULL);
local_tm = localtime(&timesec); local_tm = localtime(&timesec);