diff options
author | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-24 21:37:36 +0000 |
---|---|---|
committer | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-24 21:37:36 +0000 |
commit | 22d2ba7a76e1492ea861e124a46e5c7d46098361 (patch) | |
tree | 0d0bcec3d44217c39a6040a19c51a0e9135f2d4f /chrome/nacl | |
parent | fe4773064a50bb772fa62c7205e14e89e8c6b9a4 (diff) | |
download | chromium_src-22d2ba7a76e1492ea861e124a46e5c7d46098361.zip chromium_src-22d2ba7a76e1492ea861e124a46e5c7d46098361.tar.gz chromium_src-22d2ba7a76e1492ea861e124a46e5c7d46098361.tar.bz2 |
NaCl: Provide the /dev/urandom FD via NaCl's new embedding interface
This will allow an "#ifdef NACL_STANDALONE" to be removed from the NaCl side.
BUG=http://code.google.com/p/nativeclient/issues/detail?id=2655
TEST=nacl_integration on Unix
Review URL: https://chromiumcodereview.appspot.com/10442009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138901 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/nacl')
-rw-r--r-- | chrome/nacl/nacl_listener.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/chrome/nacl/nacl_listener.cc b/chrome/nacl/nacl_listener.cc index e2c2ed2..1f48ef5 100644 --- a/chrome/nacl/nacl_listener.cc +++ b/chrome/nacl/nacl_listener.cc @@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" +#include "base/rand_util_c.h" #include "chrome/common/nacl_messages.h" #include "chrome/nacl/nacl_validation_db.h" #include "chrome/nacl/nacl_validation_query.h" @@ -191,6 +192,11 @@ void NaClListener::OnMsgStart(const nacl::NaClStartParams& params) { std::vector<nacl::FileDescriptor> handles = params.handles; #if defined(OS_LINUX) || defined(OS_MACOSX) + args->urandom_fd = dup(GetUrandomFD()); + if (args->urandom_fd < 0) { + LOG(ERROR) << "Failed to dup() the urandom FD"; + return; + } args->create_memory_object_func = CreateMemoryObject; # if defined(OS_MACOSX) CHECK(handles.size() >= 1); |