diff options
Diffstat (limited to 'cipher/random.c')
-rw-r--r-- | cipher/random.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cipher/random.c b/cipher/random.c index 852936dba..f047f6829 100644 --- a/cipher/random.c +++ b/cipher/random.c @@ -43,6 +43,9 @@ #ifdef HAVE_GETTIMEOFDAY #include <sys/times.h> #endif +#ifdef HAVE_CLOCK_GETTIME + #include <time.h> +#endif #ifdef HAVE_GETRUSAGE #include <sys/resource.h> #endif @@ -306,7 +309,7 @@ read_seed_file() close(fd); return 0; } - if( !S_ISREG(sb.st_mode) || S_ISLNK(sb.st_mode) ) { + if( !S_ISREG(sb.st_mode) ) { log_info(_("`%s' is not a regular file - ignored\n"), seed_file_name ); close(fd); return 0; @@ -557,6 +560,13 @@ fast_random_poll() add_randomness( &tv.tv_sec, sizeof(tv.tv_sec), 1 ); add_randomness( &tv.tv_usec, sizeof(tv.tv_usec), 1 ); } + #elif HAVE_CLOCK_GETTIME + { struct timespec tv; + if( clock_gettime( CLOCK_REALTIME, &tv ) == -1 ) + BUG(); + add_randomness( &tv.tv_sec, sizeof(tv.tv_sec), 1 ); + add_randomness( &tv.tv_nsec, sizeof(tv.tv_nsec), 1 ); + } #else /* use times */ #ifndef HAVE_DOSISH_SYSTEM { struct tms buf; |