X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fturbostat.c;h=2d8a08e646319b961f8ffb24f1a8654bb470c23f;hb=ba420266281dac4ee5c1db44299db9594fb5b15a;hp=a1faac4819856c3d8087aa4dfeb6a302f75495b7;hpb=448627953cde2f7b3b138f53f4f2c62f0d48b726;p=collectd.git diff --git a/src/turbostat.c b/src/turbostat.c index a1faac48..2d8a08e6 100644 --- a/src/turbostat.c +++ b/src/turbostat.c @@ -1475,8 +1475,6 @@ static int check_permissions(void) { - int ret = 0; - if (getuid() == 0) { /* We have everything we need */ return 0; @@ -1489,6 +1487,8 @@ check_permissions(void) #else /* HAVE_SYS_CAPABILITY_H && CAP_SYS_RAWIO */ } + int ret = 0; + if (check_capability(CAP_SYS_RAWIO) != 0) { WARNING("turbostat plugin: Collectd doesn't have the " "CAP_SYS_RAWIO capability. If you don't want to run "