diff options
author | David <dbphillipsnz@gmail.com> | 2014-06-04 19:54:12 +1200 |
---|---|---|
committer | David <dbphillipsnz@gmail.com> | 2014-06-04 19:54:12 +1200 |
commit | d1e3b814cbb9c08ce5a626445cd2930b13a9893c (patch) | |
tree | 3be25fcb01302bdf2ffc467907436aa6f58958a0 /trayfreq_set_interface.c | |
parent | 2747e2b658b2f27897a80345cb3afb196c0e7c3b (diff) | |
download | paramano-d1e3b814cbb9c08ce5a626445cd2930b13a9893c.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); } |