test: prevent running the tests as root

This commit is contained in:
Charlie McConnell 2012-06-25 14:51:52 -07:00 committed by Ben Noordhuis
parent 7573f4a4c4
commit f3fd8e3c1b

View File

@ -40,6 +40,11 @@
/* Do platform-specific initialization. */
void platform_init(int argc, char **argv) {
/* Running the tests as root is not smart - don't do it. */
if (getuid() == 0) {
fprintf(stderr, "Running the tests as root is not safe.\n");
exit(1);
}
/* Disable stdio output buffering. */
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);