dhcp.c: suppress warning in rfc951_sleep().

This commit is contained in:
Leonid Krivoshein 2018-04-22 19:26:01 +03:00
parent 6afa449e2e
commit d2866d5d21

12
dhcp.c
View File

@ -359,12 +359,20 @@ static void rfc951_sleep(int exp)
long q;
unsigned long tmo;
union {
char c[sizeof(gen_hwaddr)];
long l;
short s[3];
} hw;
if (exp > BACKOFF_LIMIT)
exp = BACKOFF_LIMIT;
if (!seed)
if (!seed) {
/* Initialize linear congruential generator. */
seed = (currticks () + *(long *) &gen_hwaddr + ((short *) gen_hwaddr)[2]);
memcpy(&hw.c, &gen_hwaddr, sizeof(gen_hwaddr));
seed = currticks() + hw.l + hw.s[2];
}
/* Simplified version of the LCG given in Bruce Scheier's
"Applied Cryptography". */