X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fmagic.c;h=9e95994953812e52dbeecd253f9bc23fbc08f26f;hp=7391b1405df8a52b7649bd3390f2f24bcd06afc1;hb=88890fc13f9b346db647c882b376926686177112;hpb=692445d687c1874c9da1b77875dbfc8e50a9a6ae diff --git a/pppd/magic.c b/pppd/magic.c index 7391b14..9e95994 100644 --- a/pppd/magic.c +++ b/pppd/magic.c @@ -18,35 +18,35 @@ */ #ifndef lint -static char rcsid[] = "$Id: magic.c,v 1.4 1995/04/24 05:57:01 paulus Exp $"; +static char rcsid[] = "$Id: magic.c,v 1.6 1996/04/04 03:58:41 paulus Exp $"; #endif #include +#include #include #include #include "pppd.h" #include "magic.h" -static u_int32_t next; /* Next value to return */ - -extern int gethostid __P((void)); extern long mrand48 __P((void)); extern void srand48 __P((long)); - /* * magic_init - Initialize the magic number generator. * * Attempts to compute a random number seed which will not repeat. - * The current method uses the current hostid and current time, currently. + * The current method uses the current hostid, current process ID + * and current time, currently. */ void magic_init() { long seed; + struct timeval t; - seed = gethostid() ^ time(NULL); + gettimeofday(&t, NULL); + seed = gethostid() ^ t.tv_sec ^ t.tv_usec ^ getpid(); srand48(seed); }