summaryrefslogtreecommitdiffstats
path: root/src/crypto/rand/urandom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/rand/urandom.c')
-rw-r--r--src/crypto/rand/urandom.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/crypto/rand/urandom.c b/src/crypto/rand/urandom.c
index 1cc5260..5bf5c73 100644
--- a/src/crypto/rand/urandom.c
+++ b/src/crypto/rand/urandom.c
@@ -83,11 +83,15 @@ static void init_once(void) {
int flags = fcntl(fd, F_GETFD);
if (flags == -1) {
- abort();
- }
- flags |= FD_CLOEXEC;
- if (fcntl(fd, F_SETFD, flags) == -1) {
- abort();
+ /* Native Client doesn't implement |fcntl|. */
+ if (errno != ENOSYS) {
+ abort();
+ }
+ } else {
+ flags |= FD_CLOEXEC;
+ if (fcntl(fd, F_SETFD, flags) == -1) {
+ abort();
+ }
}
urandom_fd = fd;
}