From: Sebastian Harl Date: Thu, 11 Dec 2014 21:42:39 +0000 (+0100) Subject: sysdb: Fixed check for duplicate history entries. X-Git-Tag: sysdb-0.7.0~112^2~3 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=61fb7758fbd38b620b648d18d7e14bcd11116378 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. --- 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;