/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright (c) 2015, Joyent, Inc.
*/
/*
* Tests to make sure that a parent and child do not get the same arc4random
* state across a fork. This source file is used to make two tests. One which
* initializes the data in advance, one of which does not.
*/
#include <stdlib.h>
#include <assert.h>
#include <errno.h>
#include <unistd.h>
typedef struct arc4_fork {
} arc4_fork_t;
int
main(void)
{
int e, i;
#ifdef ARC4_PREINIT
(void) arc4random();
#endif
p = fork();
assert(p != -1);
if (p == 0) {
exit(0);
}
do {
/* Now verify our data doesn't match */
/*
* For the buffer here, we're mostly concerned that they aren't somehow
* getting the same stream.
*/
break;
}
return (0);
}