From 61fb7758fbd38b620b648d18d7e14bcd11116378 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 11 Dec 2014 22:42:39 +0100 Subject: [PATCH] sysdb: Fixed check for duplicate history entries. current_history() returns the currently *selected* history entry. Rather, we want the latest entry, that is, the one added last. --- src/tools/sysdb/input.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tools/sysdb/input.c b/src/tools/sysdb/input.c index 08f639f..a88b226 100644 --- a/src/tools/sysdb/input.c +++ b/src/tools/sysdb/input.c @@ -280,18 +280,18 @@ sdb_input_exec_query(void) { char *query = sdb_command_exec(sysdb_input); - HIST_ENTRY *current_hist; - const char *hist_line = NULL; + HIST_ENTRY *hist; + const char *prev = NULL; if (! query) return -1; - current_hist = current_history(); - if (current_hist) - hist_line = current_hist->line; + hist = history_get(history_length); + if (hist) + prev = hist->line; if (*query != ' ') - if ((! hist_line) || strcmp(hist_line, query)) + if ((! prev) || strcmp(prev, query)) add_history(query); free(query); return 0; -- 2.30.2