summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2015-01-21 14:02:27 -0800
committerBen Longbons <b.r.longbons@gmail.com>2015-01-21 14:02:27 -0800
commite5b967ec9021f2bbfb373b8c164aada8084846fd (patch)
treeb42132f234a22f3f252092ef8ed25c946b3fc6e4
parent8f3cbcd68f95e1977e0fe0c9fdc40de2c2c9edee (diff)
downloadtmwa-e5b967ec9021f2bbfb373b8c164aada8084846fd.tar.gz
tmwa-e5b967ec9021f2bbfb373b8c164aada8084846fd.tar.bz2
tmwa-e5b967ec9021f2bbfb373b8c164aada8084846fd.tar.xz
tmwa-e5b967ec9021f2bbfb373b8c164aada8084846fd.zip
I thought this went without saying
-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();