From: Costa Tsaousis (ktsaou) Date: Sun, 29 Jan 2017 19:26:54 +0000 (+0200) Subject: check both uid and euid for root X-Git-Tag: ab-debian_0.20170201.01-0ab1~10^2~1 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netdata.git;a=commitdiff_plain;h=8c58f78f3304c18368e1a5655716ff0807ef1218 check both uid and euid for root --- diff --git a/src/apps_plugin.c b/src/apps_plugin.c index c17560c1..dc571233 100644 --- a/src/apps_plugin.c +++ b/src/apps_plugin.c @@ -3013,16 +3013,13 @@ static void parse_args(int argc, char **argv) } static int am_i_running_as_root() { - if(getuid() != 0) { - if(debug) - info("I am not running as root."); - return 0; + if(getuid() == 0 || geteuid() == 0) { + if(debug) info("I am running as root."); + return 1; } - if(debug) - info("I am running as root."); - - return 1; + if(debug) info("I am not running as root."); + return 0; } #ifdef HAVE_CAPABILITY