aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2003-05-08 21:53:32 +0000
committerDavid Shaw <[email protected]>2003-05-08 21:53:32 +0000
commitf20f778c8546254b45ef67b162708a9ddc438bb3 (patch)
tree5dcbea79204e5ad09ad02d0006239c50ceaa63c8
parent* README: Remove note about HP/UX inline problem since autoconf now (diff)
downloadgnupg-f20f778c8546254b45ef67b162708a9ddc438bb3.tar.gz
gnupg-f20f778c8546254b45ef67b162708a9ddc438bb3.zip
* cipher.c (fast_random_poll): Only use times() if we HAVE_TIMES.
-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