aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Merajul Islam Molla <meraj.enigma@gmail.com>2014-06-09 10:02:15 +0530
committerAmit Kucheria <amit.kucheria@linaro.org>2014-06-09 10:12:30 +0530
commit00def050a7ecf8b9ce431afe875e047632371259 (patch)
treed85d71b5981e9bb9896d12ea63705e5fe0b59f69
parentf45331cb495229be0b9fea30996e087d7d192c00 (diff)
Only trace mode needs root privileges
Signed-off-by: Mohammad Merajul Islam Molla <meraj.enigma@gmail.com> Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
-rw-r--r--idlestat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/idlestat.c b/idlestat.c
index a3e081b..5b41062 100644
--- a/idlestat.c
+++ b/idlestat.c
@@ -1229,9 +1229,9 @@ int main(int argc, char *argv[], char *const envp[])
if (args <= 0)
return 1;
- /* We have to manipulate some files only accessible to root */
- if (getuid()) {
- fprintf(stderr, "must be root to run the tool\n");
+ /* Tracing requires manipulation of some files only accessible to root */
+ if ((options.mode == TRACE) && getuid()) {
+ fprintf(stderr, "must be root to run traces\n");
return -1;
}