-
Notifications
You must be signed in to change notification settings - Fork 920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rec: delete temp file on failure to dump RPZ file #15033
rec: delete temp file on failure to dump RPZ file #15033
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pdns/recursordist/rpzloader.cc
Outdated
SLOG(g_log << Logger::Warning << "Error while moving the content of the RPZ zone " << zoneName << " to the dump file: " << stringerror() << endl, | ||
logger->error(Logr::Error, errno, "Error while moving the content of the RPZ", "destination_file", Logging::Loggable(dumpZoneFileName))); | ||
return false; | ||
} | ||
|
||
tempFile->clear(); // file is renamed, no need to unlink |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tempFile->clear(); // file is renamed, no need to unlink | |
tempFile->clear(); // file has been renamed, no need to unlink |
std::string temp = dumpZoneFileName + "XXXXXX"; | ||
int fileDesc = mkstemp(&temp.at(0)); | ||
auto tempFile = UniqueFilenameDeleterPtr(new string(dumpZoneFileName + "XXXXXX")); | ||
int fileDesc = mkstemp(tempFile->data()); | ||
if (fileDesc < 0) { | ||
SLOG(g_log << Logger::Warning << "Unable to open a file to dump the content of the RPZ zone " << zoneName << endl, | ||
logger->error(Logr::Error, errno, "Unable to create temporary file")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make sense to clear the filename in this case as well, because we know it doesn't exist yet.
15b0e4e
to
a472992
Compare
Pull Request Test Coverage Report for Build 12750666660Details
💛 - Coveralls |
10a3c02
to
9817dc5
Compare
Short description
Checklist
I have: