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

Unified Diff: src/platform/update_engine/utils.cc

Issue 467051: AU: Use Omaha ID rather than MAC address in delta updater (Closed)
Patch Set: fixes for review Created 11 years 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 | « src/platform/update_engine/utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/update_engine/utils.cc
diff --git a/src/platform/update_engine/utils.cc b/src/platform/update_engine/utils.cc
index 693062df6a4a77aa3ed2b1b88640a6fbaf89feee..9fa0906c0eec4d5a3244cf78ba8ae0eb5913fe23 100644
--- a/src/platform/update_engine/utils.cc
+++ b/src/platform/update_engine/utils.cc
@@ -8,12 +8,14 @@
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <algorithm>
#include "chromeos/obsolete_logging.h"
+#include "update_engine/file_writer.h"
using std::min;
using std::string;
@@ -23,6 +25,16 @@ namespace chromeos_update_engine {
namespace utils {
+bool WriteFile(const char* path, const char* data, int data_len) {
+ DirectFileWriter writer;
+ TEST_AND_RETURN_FALSE_ERRNO(0 == writer.Open(path,
+ O_WRONLY | O_CREAT | O_TRUNC,
+ 0666));
+ ScopedFileWriterCloser closer(&writer);
+ TEST_AND_RETURN_FALSE_ERRNO(data_len == writer.Write(data, data_len));
+ return true;
+}
+
bool ReadFile(const std::string& path, std::vector<char>* out) {
CHECK(out);
FILE* fp = fopen(path.c_str(), "r");
« no previous file with comments | « src/platform/update_engine/utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698