summaryrefslogtreecommitdiff
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>2000-08-31 00:46:13 +0000
committerbrian <brian@cvs.openbsd.org>2000-08-31 00:46:13 +0000
commit5df48f58342e61c96870036fcffdd1bb85678a9b (patch)
tree83655e343d6e847430b6e321eec6adb95c039fc6 /usr.sbin/ppp
parent45a6cc7b1d9975327303c406d633bc3aa89c2584 (diff)
Use arc4random() instead of random()
Suggested by: Theo
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r--usr.sbin/ppp/ppp/defs.c6
-rw-r--r--usr.sbin/ppp/ppp/defs.h8
2 files changed, 11 insertions, 3 deletions
diff --git a/usr.sbin/ppp/ppp/defs.c b/usr.sbin/ppp/ppp/defs.c
index 6ca6f115ed7..022efc4fa17 100644
--- a/usr.sbin/ppp/ppp/defs.c
+++ b/usr.sbin/ppp/ppp/defs.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: defs.c,v 1.15 2000/08/30 22:04:56 brian Exp $
+ * $OpenBSD: defs.c,v 1.16 2000/08/31 00:46:12 brian Exp $
*/
@@ -53,10 +53,11 @@
#define issep(c) ((c) == '\t' || (c) == ' ')
+#if defined(__NetBSD__) || __FreeBSD__ < 3
void
randinit()
{
-#if defined(__OpenBSD__) || __FreeBSD__ >= 3
+#if defined(__FreeBSD__)
static int initdone; /* srandomdev() call is only required once */
if (!initdone) {
@@ -67,6 +68,7 @@ randinit()
srandom((time(NULL)^getpid())+random());
#endif
}
+#endif
ssize_t
fullread(int fd, void *v, size_t n)
diff --git a/usr.sbin/ppp/ppp/defs.h b/usr.sbin/ppp/ppp/defs.h
index e2a70eb0074..15ae31784da 100644
--- a/usr.sbin/ppp/ppp/defs.h
+++ b/usr.sbin/ppp/ppp/defs.h
@@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $OpenBSD: defs.h,v 1.16 2000/08/16 09:07:27 brian Exp $
+ * $OpenBSD: defs.h,v 1.17 2000/08/31 00:46:12 brian Exp $
*
* TODO:
*/
@@ -102,7 +102,13 @@
#define ROUNDUP(x) ((x) ? (1 + (((x) - 1) | (sizeof(long) - 1))) : sizeof(long))
+#if defined(__NetBSD__) || __FreeBSD__ < 3
extern void randinit(void);
+#else
+#define random arc4random
+#define randinit()
+#endif
+
extern ssize_t fullread(int, void *, size_t);
extern const char *mode2Nam(int);
extern int Nam2mode(const char *);