mirror of
https://github.com/znc/znc.git
synced 2026-08-07 01:13:25 +02:00
CZNC::WriteNewConfig() check for errors
This code now errors out if there is any error while writing the config. I tested this with a full file system (full tmpfs of size 4k). Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user