From: darkcoven Date: Sun, 6 Oct 2013 10:58:03 +0000 (+0200) Subject: Cli: fix crash when interrupting an automatic login attempt X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5b6cf83fc4d11e65d212975bb1e2504dbf9125cb;p=ngadmin Cli: fix crash when interrupting an automatic login attempt --- diff --git a/cli/admin.c b/cli/admin.c index f5b691b..40f5431 100644 --- a/cli/admin.c +++ b/cli/admin.c @@ -15,8 +15,6 @@ #define MAXCOM 32 -int main_loop_continue = 1; - static const struct TreeNode* getSubCom (char **com, int n, int *t) { @@ -107,6 +105,7 @@ static char** my_completion (const char *text, int start, int end UNUSED) } +int main_loop_continue; static struct ngadmin *nga; static sigjmp_buf jmpbuf; static struct termios orig_term; @@ -125,7 +124,7 @@ NORET static void handler (int sig) current_term.c_lflag |= ECHO; tcsetattr(STDIN_FILENO, TCSANOW, ¤t_term); - if (!batch) + if (!batch && main_loop_continue) siglongjmp(jmpbuf, 1); default: @@ -331,6 +330,7 @@ int main (int argc, char **argv) sigsetjmp(jmpbuf, 1); } + main_loop_continue = 1; while (main_loop_continue) { /* read user input */ line = NULL;