--- projects/libstatgrab/examples/os_info.c 2003/08/24 15:23:47 1.1 +++ projects/libstatgrab/examples/os_info.c 2004/04/06 14:52:56 1.8 @@ -1,7 +1,7 @@ /* - * i-scream central monitoring system - * http://www.i-scream.org.uk - * Copyright (C) 2000-2002 i-scream + * i-scream libstatgrab + * 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 @@ -16,6 +16,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id: os_info.c,v 1.8 2004/04/06 14:52:56 tdb Exp $ */ #include @@ -24,11 +26,20 @@ #include int main(int argc, char **argv){ - - general_stat_t *general_stats; - general_stats = get_general_stats(); + sg_host_info *general_stats; + /* Initialise statgrab */ + sg_init(); + + /* Drop setuid/setgid privileges. */ + if (sg_drop_privileges() != 0) { + perror("Error. Failed to drop privileges"); + return 1; + } + + general_stats = sg_get_host_info(); + if(general_stats == NULL){ fprintf(stderr, "Failed to get os stats\n"); exit(1); @@ -43,6 +54,3 @@ int main(int argc, char **argv){ exit(0); } - - -