diff options
author | koekeishiya <aasvi93@hotmail.com> | 2017-08-24 11:31:39 +0200 |
---|---|---|
committer | koekeishiya <aasvi93@hotmail.com> | 2017-08-24 11:31:39 +0200 |
commit | d1eb491b83b5b77d3a79d71855f3388428a16c22 (patch) | |
tree | c340cb3ca134c9a32ffabc6dba827967fa1f871c | |
parent | a97f0fb98a874d1bcea93938c81749931203e136 (diff) | |
download | skhd-d1eb491b83b5b77d3a79d71855f3388428a16c22.tar.gz skhd-d1eb491b83b5b77d3a79d71855f3388428a16c22.zip |
#3 prevent ourselves from running as root
-rw-r--r-- | src/skhd.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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"); } |