diff --git a/znc.cpp b/znc.cpp index 346a1c65..c8616f9f 100644 --- a/znc.cpp +++ b/znc.cpp @@ -859,11 +859,24 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { if (bFileOpen) { File.Close(); - CUtils::PrintStatus(true); + if (File.HadError()) + CUtils::PrintStatus(false, "There was an error while writing the config"); + else + CUtils::PrintStatus(true); } else { cout << endl << "----------------------------------------------------------------------------" << endl << endl; } + if (File.HadError()) { + bFileOpen = false; + CUtils::PrintMessage("Printing the new config to stdout instead:"); + cout << endl << "----------------------------------------------------------------------------" << endl << endl; + for (unsigned int a = 0; a < vsLines.size(); a++) { + cout << vsLines[a] << endl; + } + cout << endl << "----------------------------------------------------------------------------" << endl << endl; + } + const CString sProtocol(sSSL.empty() ? "http" : "https"); CUtils::PrintMessage(""); CUtils::PrintMessage("To connect to this ZNC you need to connect to it as your IRC server", true);