From: Gunnar Beutner Date: Mon, 8 Aug 2016 06:01:52 +0000 (+0200) Subject: Don't add empty lines to libedit's history X-Git-Tag: v2.5.0~128 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26821d1a790a7aa6805378044a0611074d9cccf3;p=icinga2 Don't add empty lines to libedit's history refs #12234 --- diff --git a/lib/cli/consolecommand.cpp b/lib/cli/consolecommand.cpp index 5da45da65..005ea9e19 100644 --- a/lib/cli/consolecommand.cpp +++ b/lib/cli/consolecommand.cpp @@ -268,14 +268,12 @@ incomplete: if (!cline) break; - if (commandOnce.IsEmpty()) { + if (commandOnce.IsEmpty() && cline[0] != '\0') { add_history(cline); - if (cline[0] != '\0') { - historyfp.open(historyPath.CStr(), std::fstream::out | std::fstream::app); - historyfp << cline << "\n"; - historyfp.close(); - } + historyfp.open(historyPath.CStr(), std::fstream::out | std::fstream::app); + historyfp << cline << "\n"; + historyfp.close(); } line = cline;