vtysh: move user_mode to header file, keep checkpatch happy

Signed-off-by: Lou Berger <lberger@labn.net>
This commit is contained in:
Lou Berger 2018-03-15 18:11:06 -04:00
parent 86b286101b
commit 186f6af280
3 changed files with 7 additions and 3 deletions

View File

@ -305,7 +305,6 @@ static int vtysh_execute_func(const char *line, int pager)
int closepager = 0; int closepager = 0;
int tried = 0; int tried = 0;
int saved_ret, saved_node; int saved_ret, saved_node;
extern int user_mode;
/* Split readline string up into the vector. */ /* Split readline string up into the vector. */
vline = cmd_make_strvec(line); vline = cmd_make_strvec(line);

View File

@ -100,4 +100,6 @@ extern int execute_flag;
extern struct vty *vty; extern struct vty *vty;
extern int user_mode;
#endif /* VTYSH_H */ #endif /* VTYSH_H */

View File

@ -61,7 +61,7 @@ static char history_file[MAXPATHLEN];
int execute_flag = 0; int execute_flag = 0;
/* Flag to indicate if in user/unprivileged mode. */ /* Flag to indicate if in user/unprivileged mode. */
int user_mode = 0; int user_mode;
/* For sigsetjmp() & siglongjmp(). */ /* For sigsetjmp() & siglongjmp(). */
static sigjmp_buf jmpbuf; static sigjmp_buf jmpbuf;
@ -315,6 +315,8 @@ int main(int argc, char **argv, char **env)
realgid = getgid(); realgid = getgid();
suid_off(); suid_off();
user_mode = 0; /* may be set in options processing */
/* Preserve name of myself. */ /* Preserve name of myself. */
progname = ((p = strrchr(argv[0], '/')) ? ++p : argv[0]); progname = ((p = strrchr(argv[0], '/')) ? ++p : argv[0]);
@ -323,7 +325,8 @@ int main(int argc, char **argv, char **env)
/* Option handling. */ /* Option handling. */
while (1) { while (1) {
opt = getopt_long(argc, argv, "be:c:d:nf:mEhCwN:u", longopts, 0); opt = getopt_long(argc, argv, "be:c:d:nf:mEhCwN:u",
longopts, 0);
if (opt == EOF) if (opt == EOF)
break; break;