aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2016-10-04 16:18:16 +0200
committerKarel Zak <kzak@redhat.com>2016-10-04 16:18:16 +0200
commit0b27fcc189fc772613ed86b315bc211d7a86bc3b (patch)
tree4ebd59061ed400a6c050e72610e69960244d81a4
parenta86b9f252c9d04a23cee9422b4e03ab3d79e348b (diff)
downloadutil-linux-0b27fcc189fc772613ed86b315bc211d7a86bc3b.tar.gz
lib/randutils: remove unnecessary function
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--include/randutils.h1
-rw-r--r--lib/randutils.c12
2 files changed, 3 insertions, 10 deletions
diff --git a/include/randutils.h b/include/randutils.h
index 7094a4c740..86e35f3f4b 100644
--- a/include/randutils.h
+++ b/include/randutils.h
@@ -7,7 +7,6 @@
#endif
/* rand() based */
-extern void xsrand(void);
extern int rand_get_number(int low_n, int high_n);
/* /dev/urandom based with fallback to rand() */
diff --git a/lib/randutils.c b/lib/randutils.c
index 2e124bcb66..b93b9ba470 100644
--- a/lib/randutils.c
+++ b/lib/randutils.c
@@ -30,14 +30,6 @@
THREAD_LOCAL unsigned short ul_jrand_seed[3];
#endif
-void xsrand(void)
-{
- struct timeval tv;
-
- gettimeofday(&tv, 0);
- srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
-}
-
int rand_get_number(int low_n, int high_n)
{
return rand() % (high_n - low_n + 1) + low_n;
@@ -56,7 +48,9 @@ int random_get_fd(void)
if (i >= 0)
fcntl(fd, F_SETFD, i | FD_CLOEXEC);
}
- xsrand();
+
+ gettimeofday(&tv, 0);
+ srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
#ifdef DO_JRAND_MIX
ul_jrand_seed[0] = getpid() ^ (tv.tv_sec & 0xFFFF);