diff options
author | David <dbphillipsnz@gmail.com> | 2014-06-04 19:54:12 +1200 |
---|---|---|
committer | David <dbphillipsnz@gmail.com> | 2014-06-06 20:31:40 +1200 |
commit | 38f928b2f33ec527490899e580e5ee1327a327e9 (patch) | |
tree | 8e7d50f2d5a50e20e8f384241afe782ea94653a3 /trayfreq_set_interface.c | |
parent | 4634e137f7c1ab4a06ae6b6e808510159be55000 (diff) | |
download | paramano-38f928b2f33ec527490899e580e5ee1327a327e9.tar.xz |
Moved away from manual setting of sudo-ness
Diffstat (limited to 'trayfreq_set_interface.c')
-rw-r--r-- | trayfreq_set_interface.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/trayfreq_set_interface.c b/trayfreq_set_interface.c index d16c160..a2e20c8 100644 --- a/trayfreq_set_interface.c +++ b/trayfreq_set_interface.c @@ -18,33 +18,33 @@ #include "trayfreq_set_interface.h" -#include "debug.h" -#include "defaults.h" +#include "common.h" #include <stdio.h> #include <stdlib.h> +#include <unistd.h> void si_gov(char* gov, int core) { char cmd[256]; - if (_DEFAULT_USE_SUDO) + if (getuid() != ROOT_UID) { sprintf(cmd, SUDO" "TRAYFREQ_SET" -g %s -c %i",gov,core); } else { sprintf(cmd, TRAYFREQ_SET" -g %s -c %i",gov,core); } - debug("Running '%s'\n",cmd); + info("Running '%s'\n",cmd); system(cmd); } void si_freq(int freq, int core) { char cmd[256]; - if (_DEFAULT_USE_SUDO) + if (getuid() != ROOT_UID) { sprintf(cmd, SUDO" "TRAYFREQ_SET" -f %i -c %i",freq,core); } else { sprintf(cmd, TRAYFREQ_SET" -f %i -c %i",freq,core); } - debug("Running '%s'\n",cmd); + info("Running '%s'\n",cmd); system(cmd); } |