diff options
Diffstat (limited to 'src/lib/libc/stdlib/random.c')
-rw-r--r-- | src/lib/libc/stdlib/random.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/lib/libc/stdlib/random.c b/src/lib/libc/stdlib/random.c index f299d8e2f6..00edf2dca1 100644 --- a/src/lib/libc/stdlib/random.c +++ b/src/lib/libc/stdlib/random.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: random.c,v 1.18 2013/03/15 19:07:53 tedu Exp $ */ | 1 | /* $OpenBSD: random.c,v 1.19 2013/08/01 19:42:08 kettenis Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1983 Regents of the University of California. | 3 | * Copyright (c) 1983 Regents of the University of California. |
4 | * All rights reserved. | 4 | * All rights reserved. |
@@ -233,6 +233,11 @@ srandom(unsigned int x) | |||
233 | UNLOCK(); | 233 | UNLOCK(); |
234 | } | 234 | } |
235 | 235 | ||
236 | #if defined(APIWARN) | ||
237 | __warn_references(srandom, | ||
238 | "warning: srandom() seed choices are invariably poor"); | ||
239 | #endif | ||
240 | |||
236 | /* | 241 | /* |
237 | * srandomdev: | 242 | * srandomdev: |
238 | * | 243 | * |
@@ -267,6 +272,11 @@ srandomdev(void) | |||
267 | UNLOCK(); | 272 | UNLOCK(); |
268 | } | 273 | } |
269 | 274 | ||
275 | #if defined(APIWARN) | ||
276 | __warn_references(srandomdev, | ||
277 | "warning: srandomdev() usage; consider switching to arc4random()"); | ||
278 | #endif | ||
279 | |||
270 | /* | 280 | /* |
271 | * initstate: | 281 | * initstate: |
272 | * | 282 | * |
@@ -429,3 +439,8 @@ random(void) | |||
429 | UNLOCK(); | 439 | UNLOCK(); |
430 | return r; | 440 | return r; |
431 | } | 441 | } |
442 | |||
443 | #if defined(APIWARN) | ||
444 | __warn_references(random, | ||
445 | "warning: random() isn't random; consider using arc4random()"); | ||
446 | #endif | ||