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

Side by Side Diff: chrome/browser/chromeos/system/automatic_reboot_manager.cc

Issue 203213005: Add HANDLE_EINTR in some places missing it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac typo Created 6 years, 8 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 | « no previous file | chrome/test/chromedriver/chrome_launcher.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium 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 "chrome/browser/chromeos/system/automatic_reboot_manager.h" 5 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 base::TimeDelta ReadTimeDeltaFromFile(const base::FilePath& path) { 58 base::TimeDelta ReadTimeDeltaFromFile(const base::FilePath& path) {
59 base::ThreadRestrictions::AssertIOAllowed(); 59 base::ThreadRestrictions::AssertIOAllowed();
60 base::ScopedFD fd( 60 base::ScopedFD fd(
61 HANDLE_EINTR(open(path.value().c_str(), O_RDONLY | O_NOFOLLOW))); 61 HANDLE_EINTR(open(path.value().c_str(), O_RDONLY | O_NOFOLLOW)));
62 if (!fd.is_valid()) 62 if (!fd.is_valid())
63 return base::TimeDelta(); 63 return base::TimeDelta();
64 64
65 std::string contents; 65 std::string contents;
66 char buffer[kOneKilobyte]; 66 char buffer[kOneKilobyte];
67 ssize_t length; 67 ssize_t length;
68 while ((length = read(fd.get(), buffer, sizeof(buffer))) > 0) 68 while ((length = HANDLE_EINTR(read(fd.get(), buffer, sizeof(buffer)))) > 0)
69 contents.append(buffer, length); 69 contents.append(buffer, length);
70 70
71 double seconds; 71 double seconds;
72 if (!base::StringToDouble(contents.substr(0, contents.find(' ')), &seconds) || 72 if (!base::StringToDouble(contents.substr(0, contents.find(' ')), &seconds) ||
73 seconds < 0.0) { 73 seconds < 0.0) {
74 return base::TimeDelta(); 74 return base::TimeDelta();
75 } 75 }
76 return base::TimeDelta::FromMilliseconds(seconds * 1000.0); 76 return base::TimeDelta::FromMilliseconds(seconds * 1000.0);
77 } 77 }
78 78
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 } 410 }
411 411
412 login_screen_idle_timer_.reset(); 412 login_screen_idle_timer_.reset();
413 grace_start_timer_.reset(); 413 grace_start_timer_.reset();
414 grace_end_timer_.reset(); 414 grace_end_timer_.reset();
415 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); 415 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart();
416 } 416 }
417 417
418 } // namespace system 418 } // namespace system
419 } // namespace chromeos 419 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/test/chromedriver/chrome_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698