summaryrefslogtreecommitdiff
path: root/networking/ntpd.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2014-03-05 18:58:15 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2014-03-05 18:58:15 +0100
commit0ed5f7aacd5e412d80524a1fc7f90b55f470827b (patch)
treebf29230c0efc135ee707dc847da43a7afb743dad /networking/ntpd.c
parent2cdcb1082c3de109eef564795feb5e8a368a88cf (diff)
downloadbusybox-w32-0ed5f7aacd5e412d80524a1fc7f90b55f470827b.tar.gz
busybox-w32-0ed5f7aacd5e412d80524a1fc7f90b55f470827b.tar.bz2
busybox-w32-0ed5f7aacd5e412d80524a1fc7f90b55f470827b.zip
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>
Diffstat (limited to 'networking/ntpd.c')
-rw-r--r--networking/ntpd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c
index bf8ef0a89..44592ce54 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -827,8 +827,8 @@ send_query_to_peer(peer_t *p)
827 * 827 *
828 * Save the real transmit timestamp locally. 828 * Save the real transmit timestamp locally.
829 */ 829 */
830 p->p_xmt_msg.m_xmttime.int_partl = random(); 830 p->p_xmt_msg.m_xmttime.int_partl = rand();
831 p->p_xmt_msg.m_xmttime.fractionl = random(); 831 p->p_xmt_msg.m_xmttime.fractionl = rand();
832 p->p_xmttime = gettime1900d(); 832 p->p_xmttime = gettime1900d();
833 833
834 /* Were doing it only if sendto worked, but 834 /* Were doing it only if sendto worked, but
@@ -1652,7 +1652,7 @@ retry_interval(void)
1652 /* Local problem, want to retry soon */ 1652 /* Local problem, want to retry soon */
1653 unsigned interval, r; 1653 unsigned interval, r;
1654 interval = RETRY_INTERVAL; 1654 interval = RETRY_INTERVAL;
1655 r = random(); 1655 r = rand();
1656 interval += r % (unsigned)(RETRY_INTERVAL / 4); 1656 interval += r % (unsigned)(RETRY_INTERVAL / 4);
1657 VERB4 bb_error_msg("chose retry interval:%u", interval); 1657 VERB4 bb_error_msg("chose retry interval:%u", interval);
1658 return interval; 1658 return interval;
@@ -1666,7 +1666,7 @@ poll_interval(int exponent)
1666 exponent = 0; 1666 exponent = 0;
1667 interval = 1 << exponent; 1667 interval = 1 << exponent;
1668 mask = ((interval-1) >> 4) | 1; 1668 mask = ((interval-1) >> 4) | 1;
1669 r = random(); 1669 r = rand();
1670 interval += r & mask; /* ~ random(0..1) * interval/16 */ 1670 interval += r & mask; /* ~ random(0..1) * interval/16 */
1671 VERB4 bb_error_msg("chose poll interval:%u (poll_exp:%d exp:%d)", interval, G.poll_exp, exponent); 1671 VERB4 bb_error_msg("chose poll interval:%u (poll_exp:%d exp:%d)", interval, G.poll_exp, exponent);
1672 return interval; 1672 return interval;
@@ -2067,7 +2067,7 @@ static NOINLINE void ntp_init(char **argv)
2067 unsigned opts; 2067 unsigned opts;
2068 llist_t *peers; 2068 llist_t *peers;
2069 2069
2070 srandom(getpid()); 2070 srand(getpid());
2071 2071
2072 if (getuid()) 2072 if (getuid())
2073 bb_error_msg_and_die(bb_msg_you_must_be_root); 2073 bb_error_msg_and_die(bb_msg_you_must_be_root);