aboutsummaryrefslogtreecommitdiffstats
path: root/cipher
diff options
context:
space:
mode:
Diffstat (limited to 'cipher')
-rw-r--r--cipher/ChangeLog4
-rw-r--r--cipher/random.c12
2 files changed, 11 insertions, 5 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index 8476eb014..522b11f8e 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,7 @@
+2003-05-08 David Shaw <[email protected]>
+
+ * cipher.c (fast_random_poll): Only use times() if we HAVE_TIMES.
+
2003-04-15 Werner Koch <[email protected]>
* md.c (md_start_debug): Need to open the file in binary mode.
diff --git a/cipher/random.c b/cipher/random.c
index 8b750a7ff..95d30a77d 100644
--- a/cipher/random.c
+++ b/cipher/random.c
@@ -38,12 +38,15 @@
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
-#ifdef HAVE_GETHRTIME
+#ifdef HAVE_GETHRTIME
#include <sys/times.h>
#endif
#ifdef HAVE_GETTIMEOFDAY
#include <sys/times.h>
#endif
+#ifdef HAVE_TIMES
+ #include <sys/times.h>
+#endif
#ifdef HAVE_GETRUSAGE
#include <sys/resource.h>
#endif
@@ -650,13 +653,12 @@ fast_random_poll()
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
+ #elif defined (HAVE_TIMES)
{ struct tms buf;
- times( &buf );
+ if( times( &buf ) == -1 )
+ BUG();
add_randomness( &buf, sizeof buf, 1 );
}
- #endif
#endif
#ifdef HAVE_GETRUSAGE
#ifndef RUSAGE_SELF