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

Unified Diff: base/rand_util_posix.cc

Issue 2725713002: Use O_CLOEXEC when calling open() in rand_util_posix (Closed)
Patch Set: No O_NOCTTY (so O_CTTY?)—some Linuces don’t have it?! Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/rand_util_posix.cc
diff --git a/base/rand_util_posix.cc b/base/rand_util_posix.cc
index 6a6e05ada814d2758a46f82b2097016665179c67..469f7af9bf36ae2df93cdea214edbb661c27e574 100644
--- a/base/rand_util_posix.cc
+++ b/base/rand_util_posix.cc
@@ -13,6 +13,7 @@
#include "base/files/file_util.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/posix/eintr_wrapper.h"
namespace {
@@ -22,7 +23,7 @@ namespace {
// we can use LazyInstance to handle opening it on the first access.
class URandomFd {
public:
- URandomFd() : fd_(open("/dev/urandom", O_RDONLY)) {
+ URandomFd() : fd_(HANDLE_EINTR(open("/dev/urandom", O_RDONLY | O_CLOEXEC))) {
DCHECK_GE(fd_, 0) << "Cannot open /dev/urandom: " << errno;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698