summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/command.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-03-10 08:04:15 +0000
committerache <ache@FreeBSD.org>1997-03-10 08:04:15 +0000
commit78da0d5742784dd9287ef11059170ae612c80713 (patch)
treee47017ec38f0f2299dc9fe7635b50455dc359904 /usr.sbin/ppp/command.c
parenta340e72bff7cda56735666839b2746c30bc5008e (diff)
downloadFreeBSD-src-78da0d5742784dd9287ef11059170ae612c80713.zip
FreeBSD-src-78da0d5742784dd9287ef11059170ae612c80713.tar.gz
Do not re-initialize random numbers generator several times.
Use ^ getpid() to produce better initial state.
Diffstat (limited to 'usr.sbin/ppp/command.c')
-rw-r--r--usr.sbin/ppp/command.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index c15d94d..6feed20 100644
--- a/usr.sbin/ppp/command.c
+++ b/usr.sbin/ppp/command.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: command.c,v 1.32 1997/02/22 16:10:08 peter Exp $
+ * $Id: command.c,v 1.33 1997/03/10 06:21:00 ache Exp $
*
*/
#include <sys/types.h>
@@ -58,6 +58,7 @@ extern struct cmdtab const SetCommands[];
extern char *IfDevName;
struct in_addr ifnetmask;
+int randinit;
static int ShowCommand(), TerminalCommand(), QuitCommand();
static int CloseCommand(), DialCommand(), DownCommand();
@@ -653,7 +654,10 @@ char **argv;
if (strcasecmp(argv[0], "random") == 0) {
VarRedialTimeout = -1;
printf("Using random redial timeout.\n");
- srandom(time(0));
+ if (!randinit) {
+ srandom((unsigned)(time(NULL) ^ getpid()));
+ randinit = 1;
+ }
}
else {
timeout = atoi(argv[0]);
OpenPOWER on IntegriCloud