diff options
author | 2002-02-16 20:25:02 +0000 | |
---|---|---|
committer | 2002-02-16 20:25:02 +0000 | |
commit | 9e5d6035b295cda24f7e68f03d3b357ff1c1fbfe (patch) | |
tree | 6b670b01bd7713ec39946d0d244f1406ca0a2933 | |
parent | Deal with snprintf returning >= sizeof(buf) and simplify some (diff) | |
download | wireguard-openbsd-9e5d6035b295cda24f7e68f03d3b357ff1c1fbfe.tar.xz wireguard-openbsd-9e5d6035b295cda24f7e68f03d3b357ff1c1fbfe.zip |
Instead of #defining random() as arc4random(), just use arc4random() inline
instead of srandom() / random().
-rw-r--r-- | sbin/routed/Makefile | 3 | ||||
-rw-r--r-- | sbin/routed/main.c | 9 |
2 files changed, 5 insertions, 7 deletions
diff --git a/sbin/routed/Makefile b/sbin/routed/Makefile index 75e60b2b48e..8860d2da927 100644 --- a/sbin/routed/Makefile +++ b/sbin/routed/Makefile @@ -1,11 +1,10 @@ -# $OpenBSD: Makefile,v 1.9 1997/11/18 21:31:50 kstailey Exp $ +# $OpenBSD: Makefile,v 1.10 2002/02/16 20:25:02 millert Exp $ PROG= routed SRCS= if.c input.c main.c output.c parms.c radix.c rdisc.c table.c trace.c MAN= routed.8 CFLAGS+=-D_ROUTED -D'min(a,b)=(a < b ? a : b)' -D'log=syslog' CFLAGS+=-D'panic(s)={log(LOG_ERR,s); exit(1);}' -CFLAGS+=-D'random()=arc4random()' SUBDIR= rtquery DPADD= ${LIBCOMPAT} LDADD= -lcompat diff --git a/sbin/routed/main.c b/sbin/routed/main.c index 2ff8bb2cc55..a180aced785 100644 --- a/sbin/routed/main.c +++ b/sbin/routed/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.12 2001/07/07 18:26:20 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.13 2002/02/16 20:25:02 millert Exp $ */ /* * Copyright (c) 1983, 1988, 1993 @@ -39,7 +39,7 @@ char copyright[] = #if !defined(lint) static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.12 2001/07/07 18:26:20 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.13 2002/02/16 20:25:02 millert Exp $"; #endif #include "defs.h" @@ -276,7 +276,6 @@ usage: } mypid = getpid(); - srandom((int)(clk.tv_sec ^ clk.tv_usec ^ mypid)); /* prepare socket connected to the kernel. */ @@ -771,8 +770,8 @@ intvl_random(struct timeval *tp, /* put value here */ { tp->tv_sec = (time_t)(hi == lo ? lo - : (lo + random() % ((hi - lo)))); - tp->tv_usec = random() % 1000000; + : (lo + arc4random() % ((hi - lo)))); + tp->tv_usec = arc4random() % 1000000; } |