diff options
author | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-30 14:26:13 +0000 |
---|---|---|
committer | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-30 14:26:13 +0000 |
commit | ead8c1fa606c9a8712c8bb71bdb656f5357c717f (patch) | |
tree | 323db9d7fcb386f92b913ab876d2e2e714a78f47 /content/zygote | |
parent | a796f2093103d4895214b777ed2987a929c28f54 (diff) | |
download | chromium_src-ead8c1fa606c9a8712c8bb71bdb656f5357c717f.zip chromium_src-ead8c1fa606c9a8712c8bb71bdb656f5357c717f.tar.gz chromium_src-ead8c1fa606c9a8712c8bb71bdb656f5357c717f.tar.bz2 |
Cleanup: Remove the C version of GetUrandomFD()
I originally added this in a #includable-from-C header so that it
could be #included from NaCl-side code. However, having NaCl #include
Chromium headers is not a clean interface, and this has since been
replaced by runtime dependency injection.
We move the function to a C++ header and put it into a namespace.
Also fix the error return value for UrandomFD() so that it can't be
confused with stdin.
BUG=http://code.google.com/p/nativeclient/issues/detail?id=2655
TEST=build
Review URL: https://chromiumcodereview.appspot.com/10446043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139537 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/zygote')
-rw-r--r-- | content/zygote/zygote_main_linux.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/content/zygote/zygote_main_linux.cc b/content/zygote/zygote_main_linux.cc index 37b3d25..bbc0a0f 100644 --- a/content/zygote/zygote_main_linux.cc +++ b/content/zygote/zygote_main_linux.cc @@ -22,7 +22,6 @@ #include "base/pickle.h" #include "base/process_util.h" #include "base/rand_util.h" -#include "base/rand_util_c.h" #include "base/sys_info.h" #include "build/build_config.h" #include "crypto/nss_util.h" @@ -340,7 +339,7 @@ FILE* fopen_override(const char* path, const char* mode) __asm__ ("fopen"); __attribute__ ((__visibility__("default"))) FILE* fopen_override(const char* path, const char* mode) { if (g_am_zygote_or_renderer && strcmp(path, kUrandomDevPath) == 0) { - int fd = HANDLE_EINTR(dup(GetUrandomFD())); + int fd = HANDLE_EINTR(dup(base::GetUrandomFD())); if (fd < 0) { PLOG(ERROR) << "dup() failed."; return NULL; @@ -356,7 +355,7 @@ FILE* fopen_override(const char* path, const char* mode) { __attribute__ ((__visibility__("default"))) FILE* fopen64(const char* path, const char* mode) { if (g_am_zygote_or_renderer && strcmp(path, kUrandomDevPath) == 0) { - int fd = HANDLE_EINTR(dup(GetUrandomFD())); + int fd = HANDLE_EINTR(dup(base::GetUrandomFD())); if (fd < 0) { PLOG(ERROR) << "dup() failed."; return NULL; @@ -379,7 +378,7 @@ int xstat_override(int version, __attribute__ ((__visibility__("default"))) int xstat_override(int version, const char *path, struct stat *buf) { if (g_am_zygote_or_renderer && strcmp(path, kUrandomDevPath) == 0) { - int result = __fxstat(version, GetUrandomFD(), buf); + int result = __fxstat(version, base::GetUrandomFD(), buf); return result; } else { CHECK_EQ(0, pthread_once(&g_libc_file_io_funcs_guard, @@ -396,7 +395,7 @@ int xstat64_override(int version, __attribute__ ((__visibility__("default"))) int xstat64_override(int version, const char *path, struct stat64 *buf) { if (g_am_zygote_or_renderer && strcmp(path, kUrandomDevPath) == 0) { - int result = __fxstat64(version, GetUrandomFD(), buf); + int result = __fxstat64(version, base::GetUrandomFD(), buf); return result; } else { CHECK_EQ(0, pthread_once(&g_libc_file_io_funcs_guard, |