Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: utils.h

Issue 6346003: AU: Add a signing test with a private key that doesn't match the public one. (Closed)
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « delta_performer_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils.h
diff --git a/utils.h b/utils.h
index 86ccfb71a7f0fa11b81c473021f114367471a749..74711a84e8bb0723b8b7a4c092acf948e6337626 100644
--- a/utils.h
+++ b/utils.h
@@ -294,15 +294,20 @@ class ScopedExt2fsCloser {
// Utility class to delete a file when it goes out of scope.
class ScopedPathUnlinker {
public:
- explicit ScopedPathUnlinker(const std::string& path) : path_(path) {}
+ explicit ScopedPathUnlinker(const std::string& path)
+ : path_(path),
+ should_remove_(true) {}
~ScopedPathUnlinker() {
- if (unlink(path_.c_str()) < 0) {
+ if (should_remove_ && unlink(path_.c_str()) < 0) {
std::string err_message = strerror(errno);
LOG(ERROR) << "Unable to unlink path " << path_ << ": " << err_message;
}
}
+ void set_should_remove(bool should_remove) { should_remove_ = should_remove; }
+
private:
const std::string path_;
+ bool should_remove_;
DISALLOW_COPY_AND_ASSIGN(ScopedPathUnlinker);
};
« no previous file with comments | « delta_performer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698