| 210 |
|
char *ptr; |
| 211 |
|
|
| 212 |
|
move(0,12); |
| 213 |
< |
strncpy(hostname, stats.general_stats->hostname, sizeof(hostname)); |
| 213 |
> |
strncpy(hostname, stats.general_stats->hostname, (sizeof(hostname) - 1)); |
| 214 |
> |
/* strncpy does not NULL terminate.. If only strlcpy was on all platforms :) */ |
| 215 |
> |
hostname[14] = '\0'; |
| 216 |
|
ptr=strchr(hostname, '.'); |
| 217 |
|
/* Some hosts give back a FQDN for hostname. To avoid this, we'll |
| 218 |
|
* just blank out everything after the first "." |
| 335 |
|
move(13+stats.network_entries+counter, 62); |
| 336 |
|
printw("%7s", size_conv(disk_stat_ptr->avail)); |
| 337 |
|
move(13+stats.network_entries+counter, 73); |
| 338 |
< |
printw("%5.2f%%", 100.00 * ((float) (disk_stat_ptr->size - disk_stat_ptr->avail) / (float) disk_stat_ptr->size)); |
| 338 |
> |
printw("%5.2f%%", 100.00 * ((float) disk_stat_ptr->used / (float) (disk_stat_ptr->used + disk_stat_ptr->avail))); |
| 339 |
|
disk_stat_ptr++; |
| 340 |
|
} |
| 341 |
|
|
| 397 |
|
char ch; |
| 398 |
|
|
| 399 |
|
int delay=2; |
| 400 |
< |
|
| 400 |
> |
#ifdef ALLBSD |
| 401 |
> |
gid_t gid; |
| 402 |
> |
#endif |
| 403 |
> |
if(statgrab_init() != 0){ |
| 404 |
> |
fprintf(stderr, "statgrab_init failed. Please check the permissions\n"); |
| 405 |
> |
return 1; |
| 406 |
> |
} |
| 407 |
> |
#ifdef ALLBSD |
| 408 |
> |
if((setegid(getgid())) != 0){ |
| 409 |
> |
fprintf(stderr, "Failed to lose setgid'ness\n"); |
| 410 |
> |
return 1; |
| 411 |
> |
} |
| 412 |
> |
#endif |
| 413 |
> |
|
| 414 |
|
while ((c = getopt(argc, argv, "vhd:")) != EOF){ |
| 415 |
|
switch (c){ |
| 416 |
|
case 'd': |