Update arc4random() headers from OpenBSD

Split Linux support into its own header separate from the generic Unix
to fix a Linux-specific issue with clone(). Reset rsp to NULL on failure.
This commit is contained in:
Guillem Jover
2018-05-15 00:41:26 +02:00
parent e42381dc51
commit 3d88c999b4
5 changed files with 95 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: arc4random_linux.h,v 1.8 2014/08/13 06:04:10 deraadt Exp $ */
/* $OpenBSD: arc4random_freebsd.h,v 1.4 2016/06/30 12:19:51 bcook Exp $ */
/*
* Copyright (c) 1996, David Mazieres <dm@uun.org>
@@ -84,6 +84,7 @@ _rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsp, sizeof(**rsp));
*rsp = NULL;
return (-1);
}