[icinga-checkins] icinga.org: icinga2/master: Don't write empty lines to the history file

git at icinga.org git at icinga.org
Fri Jul 29 13:55:45 CEST 2016


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

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Fri Jul 29 13:55:07 2016 +0200

Don't write empty lines to the history file

refs #12234

---

 lib/cli/consolecommand.cpp |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/cli/consolecommand.cpp b/lib/cli/consolecommand.cpp
index 98d120c..5da45da 100644
--- a/lib/cli/consolecommand.cpp
+++ b/lib/cli/consolecommand.cpp
@@ -271,9 +271,11 @@ incomplete:
 			if (commandOnce.IsEmpty()) {
 				add_history(cline);
 
-				historyfp.open(historyPath.CStr(), std::fstream::out | std::fstream::app);
-				historyfp << cline << "\n";
-				historyfp.close();
+				if (cline[0] != '\0') {
+					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