--- projects/libstatgrab/src/saidar/saidar.c 2003/11/07 18:38:48 1.17 +++ projects/libstatgrab/src/saidar/saidar.c 2004/01/21 10:27:46 1.25 @@ -1,7 +1,7 @@ /* * i-scream central monitoring system * http://www.i-scream.org - * Copyright (C) 2000-2002 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 @@ -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: saidar.c,v 1.25 2004/01/21 10:27:46 tdb Exp $ */ #ifdef HAVE_CONFIG_H @@ -435,26 +437,21 @@ int main(int argc, char **argv){ extern int errno; int delay=2; -#ifdef ALLBSD - gid_t gid; -#endif + statgrab_init(); -#ifdef ALLBSD - if((setegid(getgid())) != 0){ - fprintf(stderr, "Failed to lose setgid'ness\n"); + if(statgrab_drop_privileges() != 0){ + fprintf(stderr, "Failed to drop setuid/setgid privileges\n"); return 1; } -#endif while ((c = getopt(argc, argv, "vhd:")) != -1){ switch (c){ case 'd': delay = atoi(optarg); - if (delay == 0){ + if (delay < 1){ fprintf(stderr, "Time must be 1 second or greater\n"); exit(1); } - delay--; break; case 'v': version_num(argv[0]); @@ -464,7 +461,6 @@ int main(int argc, char **argv){ usage(argv[0]); return 1; break; - } } @@ -490,8 +486,7 @@ int main(int argc, char **argv){ int ch = getch(); if (ch == 'q'){ - endwin(); - return 0; + break; } /* To keep the numbers slightly accurate we do not want them