From: Gunnar Beutner Date: Fri, 29 Jul 2016 11:55:07 +0000 (+0200) Subject: Don't write empty lines to the history file X-Git-Tag: v2.5.0~157 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aaa487801794a7d65521bc6b2a89c96fe93a8b27;p=icinga2 Don't write empty lines to the history file refs #12234 --- diff --git a/lib/cli/consolecommand.cpp b/lib/cli/consolecommand.cpp index 98d120cf9..5da45da65 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;