aboutsummaryrefslogtreecommitdiff
path: root/randnum.c
diff options
context:
space:
mode:
authorPhilipp Klaus <philipp.klaus@gmail.com>2011-06-21 17:12:21 +0200
committerPhilipp Klaus <philipp.klaus@gmail.com>2011-06-21 17:12:21 +0200
commit468a1f0c5bd165b6d0647b184885eb2040d7ddf4 (patch)
tree8b8116449edf5447bb3c86900007e805aac312df /randnum.c
parent6fe4e7f082beca523e237db60807e2d3535fee45 (diff)
downloadpwgen-468a1f0c5bd165b6d0647b184885eb2040d7ddf4.zip
automatic commit for pwgen-2.02
Diffstat (limited to 'randnum.c')
-rw-r--r--randnum.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/randnum.c b/randnum.c
index 3f22cfe..6afa191 100644
--- a/randnum.c
+++ b/randnum.c
@@ -1,7 +1,7 @@
/*
* randnum.c -- generate (good) randum numbers.
*
- * Copyright (C) 2001 by Theodore Ts'o
+ * Copyright (C) 2001,2002 by Theodore Ts'o
*
* This file may be distributed under the terms of the GNU Public
* License.
@@ -18,7 +18,7 @@
#include "pwgen.h"
#ifdef HAVE_DRAND48
-extern double drand48();
+extern double drand48(void);
#endif
/* Borrowed/adapted from e2fsprogs's UUID generation code */
@@ -60,8 +60,8 @@ int pw_random_number(int max_num)
{
int i, fd = get_random_fd();
int lose_counter = 0, nbytes=4;
- unsigned int rand;
- char *cp = (char *) &rand;
+ unsigned int rand_num;
+ char *cp = (char *) &rand_num;
if (fd >= 0) {
while (nbytes > 0) {
@@ -80,7 +80,7 @@ int pw_random_number(int max_num)
}
}
if (nbytes == 0)
- return (rand % max_num);
+ return (rand_num % max_num);
/* OK, we weren't able to use /dev/random, fall back to rand/rand48 */