Browse Source

Don't abort in |init_once| if |fcntl| returns ENOSYS

Native Client doesn't support fcntl natively and its default
implemention just returns ENOSYS.

Change-Id: Id8615e2f6f0a75a1140f8efd75afde471ccdf466
Reviewed-on: https://boringssl-review.googlesource.com/6721
Reviewed-by: Adam Langley <agl@google.com>
kris/onging/CECPQ3_patch15
Sam Clegg 8 years ago
committed by Adam Langley
parent
commit
dca63cfa75
1 changed files with 9 additions and 5 deletions
  1. +9
    -5
      crypto/rand/urandom.c

+ 9
- 5
crypto/rand/urandom.c View File

@@ -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;
}


Loading…
Cancel
Save