]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/randutils: remove unnecessary function
authorKarel Zak <kzak@redhat.com>
Tue, 4 Oct 2016 14:18:16 +0000 (16:18 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 4 Oct 2016 14:18:16 +0000 (16:18 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
include/randutils.h
lib/randutils.c

index 7094a4c74078fe8761286b860b3cb1cc463508dc..86e35f3f4b035447c89a25f6526ab5f74925f296 100644 (file)
@@ -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() */
index 2e124bcb66ab038df17f4f6b7c7f178e21af5368..b93b9ba4701caa93e9b58637bbd0a796c47c7069 100644 (file)
 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);