]> arthur.barton.de Git - netdata.git/commitdiff
check both uid and euid for root
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sun, 29 Jan 2017 19:26:54 +0000 (21:26 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sun, 29 Jan 2017 19:26:54 +0000 (21:26 +0200)
src/apps_plugin.c

index c17560c1910d75a5773ede2a1d560f83993b163b..dc5712333f7d25c8e02fa3264ee6e0c5f99400b2 100644 (file)
@@ -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