Browse files

test: prevent running the tests as root

  • Loading branch information...
1 parent 7573f4a commit f3fd8e3c1bf91be635ebee118ebe475c632a32c0 @AvianFlu AvianFlu committed with bnoordhuis Jun 25, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 test/runner-unix.c
View
5 test/runner-unix.c
@@ -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);

0 comments on commit f3fd8e3

Please sign in to comment.