| 1 |
|
/* |
| 2 |
|
* i-scream central monitoring system |
| 3 |
|
* http://www.i-scream.org |
| 4 |
< |
* Copyright (C) 2000-2002 i-scream |
| 4 |
> |
* Copyright (C) 2000-2004 i-scream |
| 5 |
|
* |
| 6 |
|
* This program is free software; you can redistribute it and/or |
| 7 |
|
* modify it under the terms of the GNU General Public License |
| 16 |
|
* You should have received a copy of the GNU General Public License |
| 17 |
|
* along with this program; if not, write to the Free Software |
| 18 |
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 |
+ |
* |
| 20 |
+ |
* $Id$ |
| 21 |
|
*/ |
| 22 |
|
|
| 23 |
|
#ifdef HAVE_CONFIG_H |
| 437 |
|
extern int errno; |
| 438 |
|
|
| 439 |
|
int delay=2; |
| 440 |
< |
#ifdef ALLBSD |
| 439 |
< |
gid_t gid; |
| 440 |
< |
#endif |
| 440 |
> |
|
| 441 |
|
statgrab_init(); |
| 442 |
< |
#ifdef ALLBSD |
| 443 |
< |
if((setegid(getgid())) != 0){ |
| 444 |
< |
fprintf(stderr, "Failed to lose setgid'ness\n"); |
| 442 |
> |
if(statgrab_drop_privileges() != 0){ |
| 443 |
> |
fprintf(stderr, "Failed to drop setuid/setgid privileges\n"); |
| 444 |
|
return 1; |
| 445 |
|
} |
| 447 |
– |
#endif |
| 446 |
|
|
| 447 |
|
while ((c = getopt(argc, argv, "vhd:")) != -1){ |
| 448 |
|
switch (c){ |
| 452 |
|
fprintf(stderr, "Time must be 1 second or greater\n"); |
| 453 |
|
exit(1); |
| 454 |
|
} |
| 457 |
– |
delay--; |
| 455 |
|
break; |
| 456 |
|
case 'v': |
| 457 |
|
version_num(argv[0]); |
| 461 |
|
usage(argv[0]); |
| 462 |
|
return 1; |
| 463 |
|
break; |
| 467 |
– |
|
| 464 |
|
} |
| 465 |
|
} |
| 466 |
|
|
| 486 |
|
int ch = getch(); |
| 487 |
|
|
| 488 |
|
if (ch == 'q'){ |
| 489 |
< |
endwin(); |
| 494 |
< |
return 0; |
| 489 |
> |
break; |
| 490 |
|
} |
| 491 |
|
|
| 492 |
|
/* To keep the numbers slightly accurate we do not want them |