diff options
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/random.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sal/osl/unx/random.cxx b/sal/osl/unx/random.cxx index e8379f8f0bf7..62a552ce4ea3 100644 --- a/sal/osl/unx/random.cxx +++ b/sal/osl/unx/random.cxx @@ -13,13 +13,19 @@ #include <errno.h> #include <fcntl.h> #include <unistd.h> +#include <dlfcn.h> int osl_get_system_random_data(char* buffer, size_t desired_len) { int fd; assert(buffer); - fd = open("/dev/urandom", O_RDONLY); + + static int (*lok_open_urandom)() + = reinterpret_cast<int (*)()>(dlsym(RTLD_DEFAULT, "lok_open_urandom")); + if (!lok_open_urandom || (fd = lok_open_urandom()) < 0) + fd = open("/dev/urandom", O_RDONLY); + if (fd != -1) { while (desired_len) |