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

Side by Side Diff: utils.cc

Issue 3041044: Don't schedule periodic update checks for non-official builds. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: Fix persistent storage on stack bug. Created 10 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils.h ('k') | utils_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "update_engine/utils.h" 5 #include "update_engine/utils.h"
6 #include <sys/mount.h> 6 #include <sys/mount.h>
7 #include <sys/stat.h> 7 #include <sys/stat.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <dirent.h> 9 #include <dirent.h>
10 #include <errno.h> 10 #include <errno.h>
11 #include <fcntl.h> 11 #include <fcntl.h>
12 #include <stdio.h> 12 #include <stdio.h>
13 #include <stdlib.h> 13 #include <stdlib.h>
14 #include <string.h> 14 #include <string.h>
15 #include <unistd.h> 15 #include <unistd.h>
16 #include <algorithm> 16 #include <algorithm>
17 #include "chromeos/obsolete_logging.h" 17 #include "chromeos/obsolete_logging.h"
18 #include "update_engine/file_writer.h" 18 #include "update_engine/file_writer.h"
19 #include "update_engine/omaha_request_params.h"
19 #include "update_engine/subprocess.h" 20 #include "update_engine/subprocess.h"
20 21
21 using std::min; 22 using std::min;
22 using std::string; 23 using std::string;
23 using std::vector; 24 using std::vector;
24 25
25 namespace chromeos_update_engine { 26 namespace chromeos_update_engine {
26 27
27 namespace utils { 28 namespace utils {
28 29
30 bool IsOfficialBuild() {
31 OmahaRequestDeviceParams params;
32 if (!params.Init("", "")) {
33 return true;
34 }
35 return params.app_track != "buildbot-build" &&
36 params.app_track != "developer-build";
37 }
38
29 bool WriteFile(const char* path, const char* data, int data_len) { 39 bool WriteFile(const char* path, const char* data, int data_len) {
30 DirectFileWriter writer; 40 DirectFileWriter writer;
31 TEST_AND_RETURN_FALSE_ERRNO(0 == writer.Open(path, 41 TEST_AND_RETURN_FALSE_ERRNO(0 == writer.Open(path,
32 O_WRONLY | O_CREAT | O_TRUNC, 42 O_WRONLY | O_CREAT | O_TRUNC,
33 0666)); 43 0666));
34 ScopedFileWriterCloser closer(&writer); 44 ScopedFileWriterCloser closer(&writer);
35 TEST_AND_RETURN_FALSE_ERRNO(data_len == writer.Write(data, data_len)); 45 TEST_AND_RETURN_FALSE_ERRNO(data_len == writer.Write(data, data_len));
36 return true; 46 return true;
37 } 47 }
38 48
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 Subprocess::SynchronousExec(command, &rc); 413 Subprocess::SynchronousExec(command, &rc);
404 TEST_AND_RETURN_FALSE(rc == 0); 414 TEST_AND_RETURN_FALSE(rc == 0);
405 return true; 415 return true;
406 } 416 }
407 417
408 const char* const kStatefulPartition = "/mnt/stateful_partition"; 418 const char* const kStatefulPartition = "/mnt/stateful_partition";
409 419
410 } // namespace utils 420 } // namespace utils
411 421
412 } // namespace chromeos_update_engine 422 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « utils.h ('k') | utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698