[icinga-checkins] icinga.org: icinga2/master: Don't add empty lines to libedit's history

git at icinga.org git at icinga.org
Mon Aug 8 10:37:06 CEST 2016


Module: icinga2
Branch: master
Commit: 26821d1a790a7aa6805378044a0611074d9cccf3
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=26821d1a790a7aa6805378044a0611074d9cccf3

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Mon Aug  8 08:01:52 2016 +0200

Don't add empty lines to libedit's history

refs #12234

---

 lib/cli/consolecommand.cpp |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/cli/consolecommand.cpp b/lib/cli/consolecommand.cpp
index 5da45da..005ea9e 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;



More information about the icinga-checkins mailing list