aboutsummaryrefslogtreecommitdiff
path: root/src/skhd.c
diff options
context:
space:
mode:
authorkoekeishiya <aasvi93@hotmail.com>2017-08-24 11:31:39 +0200
committerkoekeishiya <aasvi93@hotmail.com>2017-08-24 11:31:39 +0200
commitd1eb491b83b5b77d3a79d71855f3388428a16c22 (patch)
treec340cb3ca134c9a32ffabc6dba827967fa1f871c /src/skhd.c
parenta97f0fb98a874d1bcea93938c81749931203e136 (diff)
downloadskhd-d1eb491b83b5b77d3a79d71855f3388428a16c22.tar.gz
skhd-d1eb491b83b5b77d3a79d71855f3388428a16c22.zip
#3 prevent ourselves from running as root
Diffstat (limited to 'src/skhd.c')
-rw-r--r--src/skhd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/skhd.c b/src/skhd.c
index ef0d82d..0e162c6 100644
--- a/src/skhd.c
+++ b/src/skhd.c
@@ -5,6 +5,7 @@
#include <getopt.h>
#include <signal.h>
#include <string.h>
+#include <unistd.h>
#include <Carbon/Carbon.h>
@@ -201,6 +202,10 @@ int main(int argc, char **argv)
return EXIT_SUCCESS;
}
+ if(getuid() == 0 || geteuid() == 0) {
+ error("skhd: running as root is not allowed! abort..\n");
+ }
+
if(secure_keyboard_entry_enabled()) {
error("skhd: secure keyboard entry is enabled! abort..\n");
}