Add comment on use of abort() in libc

Suggested by:	jonathan (in review D8133)
This commit is contained in:
Ed Maste 2016-10-12 13:56:14 +00:00
parent 11dc8730a6
commit 49a6e1ba32
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=307148
2 changed files with 17 additions and 3 deletions

View File

@ -144,8 +144,15 @@ arc4_stir(void)
arc4_init();
rs_initialized = 1;
}
if (arc4_sysctl(rdat, KEYSIZE) != KEYSIZE)
abort(); /* Random sysctl cannot fail. */
if (arc4_sysctl(rdat, KEYSIZE) != KEYSIZE) {
/*
* The sysctl cannot fail. If it does fail on some FreeBSD
* derivative or after some future change, just abort so that
* the problem will be found and fixed. abort is not normally
* suitable for a library but makes sense here.
*/
abort();
}
arc4_addrandom(rdat, KEYSIZE);

View File

@ -279,8 +279,15 @@ srandomdev(void)
mib[0] = CTL_KERN;
mib[1] = KERN_ARND;
if (sysctl(mib, 2, state, &len, NULL, 0) == -1 || len != expected)
if (sysctl(mib, 2, state, &len, NULL, 0) == -1 || len != expected) {
/*
* The sysctl cannot fail. If it does fail on some FreeBSD
* derivative or after some future change, just abort so that
* the problem will be found and fixed. abort is not normally
* suitable for a library but makes sense here.
*/
abort();
}
if (rand_type != TYPE_0) {
fptr = &state[rand_sep];