diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2013-02-21 12:08:42 +0100 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2013-02-21 12:12:54 +0100 |
commit | 2db029c857fb0b3b566c97fe2fa5e0077ae41741 (patch) | |
tree | 20151a8a3d62f1a6bc859989337d7cc985d7e24e /src | |
parent | fced588fdddd1dc3b67502bdddfe48a69fe6222b (diff) | |
download | ipset-2db029c857fb0b3b566c97fe2fa5e0077ae41741.tar.gz |
Interactive mode error after syntax error (reported by Mart Frauenlob)
ipset> list foo
ipset v6.16.1: The set with the given name does not exist
ipset> -t
No command specified
ipset> list
ipset v6.16.1: Internal protocol error
In interactive mode the state was not cleaned up properly after a
syntax error, fixed.
Diffstat (limited to 'src')
-rw-r--r-- | src/ipset.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ipset.c b/src/ipset.c index 51b912a..d5ecf7a 100644 --- a/src/ipset.c +++ b/src/ipset.c @@ -563,6 +563,8 @@ parse_commandline(int argc, char *argv[]) case IPSET_CMD_NONE: if (interactive) { printf("No command specified\n"); + if (session) + ipset_envopt_parse(session, 0, "reset"); return 0; } if (argc > 1 && STREQ(argv[1], "-")) { @@ -574,12 +576,15 @@ parse_commandline(int argc, char *argv[]) c = cmdline; while (isspace(c[0])) c++; - if (c[0] == '\0' || c[0] == '#') + if (c[0] == '\0' || c[0] == '#') { + printf("%s> ", program_name); continue; + } /* Build fake argv, argc */ build_argv(c); - /* Execute line: ignore errors */ - parse_commandline(newargc, newargv); + /* Execute line: ignore soft errors */ + if (parse_commandline(newargc, newargv) < 0) + handle_error(); printf("%s> ", program_name); } return exit_error(NO_PROBLEM, NULL); |