Skip to content

Commit

Permalink
campaignd: Log errno to stderr if deleting an add-on archive failed
Browse files Browse the repository at this point in the history
Unhandled remove() return value issue found by coverity.

This is about the most we can do about this here since internal server
errors like this shouldn't matter to clients (remove() failing is only
an issue if write_config() somehow fails or the same add-on is
reuploaded later).

Note to self: sanitize campaignd logging later so we can actually
distinguish between informational and error messages without including
the word "error" or "failure" and variations thereof in each line.
  • Loading branch information
irydacea committed Jun 28, 2014
1 parent f46eaeb commit 786789b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/campaign_server/campaign_server.cpp
Expand Up @@ -654,7 +654,11 @@ void server::handle_delete(const server::request& req)

// Erase the campaign.
write_file(campaign["filename"], std::string());
remove(campaign["filename"].str().c_str());
if(remove(campaign["filename"].str().c_str()) != 0) {
LOG_CS << "failed to delete archive for campaign '" << erase["name"]
<< "' (" << campaign["filename"] << "): " << strerror(errno)
<< '\n';
}

config::child_itors itors = campaigns().child_range("campaign");
for(size_t index = 0; itors.first != itors.second; ++index, ++itors.first)
Expand Down

0 comments on commit 786789b

Please sign in to comment.