summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/high/core.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/high/core.cpp b/src/high/core.cpp
index a45db18..8a4d7ca 100644
--- a/src/high/core.cpp
+++ b/src/high/core.cpp
@@ -23,6 +23,7 @@
#include <sys/wait.h>
#include <alloca.h>
+#include <unistd.h>
#include <csignal>
#include <cstdlib>
@@ -106,8 +107,21 @@ void sig_proc(int)
*/
} // namespace tmwa
+static
+void check_caps()
+{
+ if (geteuid() == 0)
+ {
+ puts("Please don't run as root!");
+ _exit(1);
+ }
+}
+
int tmwa_main(int argc, char **argv)
{
+ // run before anything else (except global constructors)
+ check_caps();
+
using namespace tmwa;
check_paths();