diff options
author | Jefferson Delfes <jefferson.delfes@gmail.com> | 2013-12-02 12:04:13 -0400 |
---|---|---|
committer | Jefferson Delfes <jefferson.delfes@gmail.com> | 2013-12-02 13:14:18 -0400 |
commit | 382001f95f52e9ce51e0060efe9066ea3c282b4f (patch) | |
tree | 943804977ffc670d5632dc45f42177c738a5f0b8 | |
parent | b306059649ec817e5c80aaba767721944cd2e998 (diff) |
Check if it's running as root user
Trying to enable bluetooth module without root permission, give us some
weird issues, it does not work. So we need to check it before doing
anything.
-rw-r--r-- | btctl.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -2059,6 +2059,13 @@ const char *tab_completer_cb(char *line, int pos) { } int main(int argc, char *argv[]) { + + /* check if I am root */ + if (getuid() != 0) { + printf("This software requires root access\n"); + return 1; + } + rl_init(cmd_process); change_prompt_state(NORMAL_PSTATE); rl_set_tab_completer(tab_completer_cb); |