This is in response to:
https://bugzilla.redhat.com/show_bug.cgi?id=681078
If an invalid command was entered at the ncftool prompt, and then
"quit" was immediately issued, it would be ignored - a 2nd "quit"
would be needed to exit from ncftool.
This was caused by main_loop() checking the wrong return status when
deciding to exit. Rather than checking the status of the command that
was just run, it was looking of the status of the command just prior
to that, and only exiting if that command was successful. What was
needed was to check the return status of the "quit" command (which
currently is always 0, but I suppose may change in the future.)
---
src/ncftool.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ncftool.c b/src/ncftool.c
index 2cb139d..f86b62c 100644
--- a/src/ncftool.c
+++ b/src/ncftool.c
@@ -753,7 +753,7 @@ static int run_command_line(const char *line, int *cmdstatus)
static int main_loop(void) {
char *line;
- int ret;
+ int ret = 0;
while(1) {
int cmdret;
@@ -765,7 +765,7 @@ static int main_loop(void) {
}
cmdret = run_command_line(line, &cmdstatus);
- if (ret == 0 && cmdstatus == CMD_RES_QUIT)
+ if (cmdret == 0 && cmdstatus == CMD_RES_QUIT)
return ret;
add_history(line);
--
1.7.3.4