--- projects/libstatgrab/examples/os_info.c 2003/08/24 15:23:47 1.1 +++ projects/libstatgrab/examples/os_info.c 2004/01/16 15:54:52 1.5 @@ -1,7 +1,7 @@ /* * i-scream central monitoring system - * http://www.i-scream.org.uk - * Copyright (C) 2000-2002 i-scream + * http://www.i-scream.org + * 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 @@ -24,9 +24,18 @@ #include int main(int argc, char **argv){ - + general_stat_t *general_stats; + /* Initialise statgrab */ + statgrab_init(); + + /* Drop setuid/setgid privileges. */ + if (statgrab_drop_privileges() != 0) { + perror("Error. Failed to drop privileges"); + return 1; + } + general_stats = get_general_stats(); if(general_stats == NULL){ @@ -43,6 +52,3 @@ int main(int argc, char **argv){ exit(0); } - - -