summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3b56f64)
this prevents a fd leak to child processes
if (use_fd) {
if (fd == -1) {
fd = open( "/dev/urandom", O_RDONLY,0);
if (use_fd) {
if (fd == -1) {
fd = open( "/dev/urandom", O_RDONLY,0);
+ if (fd != -1) {
+ set_close_on_exec(fd);
+ }
}
if (fd != -1
&& (read(fd, seed_inbuf, sizeof(seed_inbuf)) == sizeof(seed_inbuf))) {
}
if (fd != -1
&& (read(fd, seed_inbuf, sizeof(seed_inbuf)) == sizeof(seed_inbuf))) {
if (bytes_since_reseed < 40) {
if (urand_fd == -1) {
urand_fd = open( "/dev/urandom", O_RDONLY,0);
if (bytes_since_reseed < 40) {
if (urand_fd == -1) {
urand_fd = open( "/dev/urandom", O_RDONLY,0);
+ if (urand_fd != -1) {
+ set_close_on_exec(urand_fd);
+ }
}
if(urand_fd != -1 && (read(urand_fd, out, len) == len)) {
return;
}
if(urand_fd != -1 && (read(urand_fd, out, len) == len)) {
return;
{
if (urand_fd == -1) {
urand_fd = open( "/dev/urandom", O_RDONLY,0);
{
if (urand_fd == -1) {
urand_fd = open( "/dev/urandom", O_RDONLY,0);
+ if (urand_fd != -1) {
+ set_close_on_exec(urand_fd);
+ }
}
if(urand_fd != -1 && (read(urand_fd, out, len) == len)) {
return;
}
if(urand_fd != -1 && (read(urand_fd, out, len) == len)) {
return;