Skip to content

Commit

Permalink
cc: Only try to list ksyms if we're root
Browse files Browse the repository at this point in the history
  • Loading branch information
vmg committed Apr 20, 2016
1 parent f088bbf commit 6b59b2c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cc/bcc_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,13 @@ int bcc_procutils_each_module(int pid, bcc_procutils_modulecb callback,

int bcc_procutils_each_ksym(bcc_procutils_ksymcb callback, void *payload) {
char line[2048];
FILE *kallsyms = fopen("/proc/kallsyms", "r");
FILE *kallsyms;

/* root is needed to list ksym addresses */
if (geteuid() != 0)
return -1;

kallsyms = fopen("/proc/kallsyms", "r");
if (!kallsyms)
return -1;

Expand Down

0 comments on commit 6b59b2c

Please sign in to comment.