1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#include "integrityscanner.ih"
bool IntegrityScanner::sameOutput(string const &logfile, Process &extractor)
{
string current = logfile + ".cur"; // create current logfile
if (!Util::mkdir(current)) // make sure directory exists
fmsg << "unable to create the logfile `" << current << '\'' << noidl;
m3 << "logs to " << current << endl;
copy(extractor, current); // copy the info in extractor
// to the current logfile
if (access(logfile.c_str(), R_OK) != 0) // no old report yet
{
m3 << "writing new report: " << logfile << '\n';
rename(current.c_str(), logfile.c_str()); // install `logfile'
if (d_label.length())
d_report << d_label << endl;
d_report << "Initialized report on " << logfile << endl;
m3 << "initialized report on " << logfile << endl;
return true;
}
m3 << "comparing new integrity scan results to: `" << logfile << '\'' <<
endl;
return noDifferences(current, logfile); // return true if there aren't any
// differences.
}
|