--- projects/libstatgrab/examples/cpu_usage.c 2003/11/23 13:51:10 1.4 +++ projects/libstatgrab/examples/cpu_usage.c 2004/01/16 15:54:52 1.6 @@ -1,7 +1,7 @@ /* * i-scream central monitoring system * http://www.i-scream.org - * Copyright (C) 2000-2003 i-scream + * Copyright (C) 2000-2004 i-scream * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -42,6 +42,12 @@ int main(int argc, char **argv){ /* Initialise statgrab */ statgrab_init(); + + /* Drop setuid/setgid privileges. */ + if (statgrab_drop_privileges() != 0) { + perror("Error. Failed to drop privileges"); + return 1; + } /* Throw away the first reading as thats averaged over the machines uptime */ cpu_percent = cpu_percent_usage();