use [s]rand(), not [s]random()
rand() is the most standard C library function, and on uclibc they are the same. I guess they are the same in most todays' libc... Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
2cdcb1082c
commit
0ed5f7aacd
@ -827,8 +827,8 @@ send_query_to_peer(peer_t *p)
|
||||
*
|
||||
* Save the real transmit timestamp locally.
|
||||
*/
|
||||
p->p_xmt_msg.m_xmttime.int_partl = random();
|
||||
p->p_xmt_msg.m_xmttime.fractionl = random();
|
||||
p->p_xmt_msg.m_xmttime.int_partl = rand();
|
||||
p->p_xmt_msg.m_xmttime.fractionl = rand();
|
||||
p->p_xmttime = gettime1900d();
|
||||
|
||||
/* Were doing it only if sendto worked, but
|
||||
@ -1652,7 +1652,7 @@ retry_interval(void)
|
||||
/* Local problem, want to retry soon */
|
||||
unsigned interval, r;
|
||||
interval = RETRY_INTERVAL;
|
||||
r = random();
|
||||
r = rand();
|
||||
interval += r % (unsigned)(RETRY_INTERVAL / 4);
|
||||
VERB4 bb_error_msg("chose retry interval:%u", interval);
|
||||
return interval;
|
||||
@ -1666,7 +1666,7 @@ poll_interval(int exponent)
|
||||
exponent = 0;
|
||||
interval = 1 << exponent;
|
||||
mask = ((interval-1) >> 4) | 1;
|
||||
r = random();
|
||||
r = rand();
|
||||
interval += r & mask; /* ~ random(0..1) * interval/16 */
|
||||
VERB4 bb_error_msg("chose poll interval:%u (poll_exp:%d exp:%d)", interval, G.poll_exp, exponent);
|
||||
return interval;
|
||||
@ -2067,7 +2067,7 @@ static NOINLINE void ntp_init(char **argv)
|
||||
unsigned opts;
|
||||
llist_t *peers;
|
||||
|
||||
srandom(getpid());
|
||||
srand(getpid());
|
||||
|
||||
if (getuid())
|
||||
bb_error_msg_and_die(bb_msg_you_must_be_root);
|
||||
|
@ -248,7 +248,7 @@ error_interval(void)
|
||||
{
|
||||
unsigned interval, r;
|
||||
interval = INTERVAL_QUERY_PATHETIC * QSCALE_OFF_MAX / QSCALE_OFF_MIN;
|
||||
r = (unsigned)random() % (unsigned)(interval / 10);
|
||||
r = (unsigned)rand() % (unsigned)(interval / 10);
|
||||
return (interval + r);
|
||||
}
|
||||
|
||||
@ -326,8 +326,8 @@ send_query_to_peer(peer_t *p)
|
||||
*
|
||||
* Save the real transmit timestamp locally.
|
||||
*/
|
||||
p->p_xmt_msg.m_xmttime.int_partl = random();
|
||||
p->p_xmt_msg.m_xmttime.fractionl = random();
|
||||
p->p_xmt_msg.m_xmttime.int_partl = rand();
|
||||
p->p_xmt_msg.m_xmttime.fractionl = rand();
|
||||
p->p_xmttime = gettime1900d();
|
||||
|
||||
if (do_sendto(p->p_fd, /*from:*/ NULL, /*to:*/ &p->p_lsa->u.sa, /*addrlen:*/ p->p_lsa->len,
|
||||
@ -531,7 +531,7 @@ scale_interval(unsigned requested)
|
||||
{
|
||||
unsigned interval, r;
|
||||
interval = requested * G.scale;
|
||||
r = (unsigned)random() % (unsigned)(MAX(5, interval / 10));
|
||||
r = (unsigned)rand() % (unsigned)(MAX(5, interval / 10));
|
||||
return (interval + r);
|
||||
}
|
||||
static void
|
||||
@ -825,7 +825,7 @@ static NOINLINE void ntp_init(char **argv)
|
||||
unsigned opts;
|
||||
llist_t *peers;
|
||||
|
||||
srandom(getpid());
|
||||
srand(getpid());
|
||||
|
||||
if (getuid())
|
||||
bb_error_msg_and_die(bb_msg_you_must_be_root);
|
||||
|
@ -224,8 +224,8 @@ int mkfs_reiser_main(int argc UNUSED_PARAM, char **argv)
|
||||
jp = &sb->sb_journal;
|
||||
STORE_LE(jp->jp_journal_1st_block, REISERFS_DISK_OFFSET_IN_BYTES / blocksize + 1/*sb*/ + 1/*bmp#0*/);
|
||||
timestamp = time(NULL);
|
||||
srandom(timestamp);
|
||||
STORE_LE(jp->jp_journal_magic, random());
|
||||
srand(timestamp);
|
||||
STORE_LE(jp->jp_journal_magic, rand());
|
||||
STORE_LE(jp->jp_journal_size, journal_blocks);
|
||||
STORE_LE(jp->jp_journal_trans_max, JOURNAL_TRANS_MAX);
|
||||
STORE_LE(jp->jp_journal_max_batch, JOURNAL_MAX_BATCH);
|
||||
|
Loading…
Reference in New Issue
Block a user