On Thu, 15 Jun 2000, Michael Stone wrote:
> entropy.c assumes RUSAGE_SELF and RUSAGE_CHILDREN
Thanks. This patch also fixes the problem of getrusage being a
privileged operation on some Unices:
Index: entropy.c
==================================================================RCS file:
/var/cvs/openssh/entropy.c,v
retrieving revision 1.13
diff -u -r1.13 entropy.c
--- entropy.c 2000/06/07 12:20:23 1.13
+++ entropy.c 2000/06/18 02:52:12
@@ -55,6 +55,13 @@
#define WHITESPACE " \t\n"
+#ifndef RUSAGE_SELF
+# define RUSAGE_SELF 0
+#endif
+#ifndef RUSAGE_CHILDREN
+# define RUSAGE_CHILDREN 0
+#endif
+
#if defined(EGD_SOCKET) || defined(RANDOM_POOL)
#ifdef EGD_SOCKET
@@ -301,9 +308,9 @@
struct rusage ru;
if (getrusage(who, &ru) == -1)
- fatal("Couldn't getrusage: %s", strerror(errno));
+ return(0);
- RAND_add(&ru, sizeof(ru), 0.1);
+ RAND_add(&ru, sizeof(ru), entropy_estimate);
return(entropy_estimate);
#else /* _HAVE_GETRUSAGE */
--
| "Bombay is 250ms from New York in the new world order" - Alan Cox
| Damien Miller - http://www.mindrot.org/
| Email: djm at mindrot.org (home) -or- djm at ibs.com.au (work)