Browse Source

Handle EINTR in open and dup calls in urandom.c.

Per review comment in
https://boringssl-review.googlesource.com/#/c/5302/7/crypto/rand/urandom.c

Change-Id: I9c279524a452cb97c60354213cbc6e2aeabe0bfa
Reviewed-on: https://boringssl-review.googlesource.com/5311
Reviewed-by: Adam Langley <agl@google.com>
kris/onging/CECPQ3_patch15
David Benjamin 9 years ago
committed by Adam Langley
parent
commit
705076ac91
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      crypto/rand/urandom.c

+ 6
- 2
crypto/rand/urandom.c View File

@@ -96,7 +96,9 @@ static int urandom_get_fd_locked(void) {
return urandom_fd;
}

urandom_fd = open("/dev/urandom", O_RDONLY);
do {
urandom_fd = open("/dev/urandom", O_RDONLY);
} while (urandom_fd == -1 && errno == EINTR);
return urandom_fd;
}

@@ -124,7 +126,9 @@ void RAND_set_urandom_fd(int fd) {
/* |RAND_set_urandom_fd| may not be called after the RNG is used. */
abort();
}
urandom_fd = dup(fd);
do {
urandom_fd = dup(fd);
} while (urandom_fd == -1 && errno == EINTR);
if (urandom_fd < 0) {
abort();
}


Loading…
Cancel
Save