Merge PR #648 from eaglegai: fix -q doesn't work when use with

'unbound-control stats_shm'
This commit is contained in:
George Thessalonikefs 2022-03-18 16:00:45 +02:00
commit 1e23c4a376
2 changed files with 11 additions and 4 deletions

View file

@ -1,3 +1,7 @@
18 March 2022: George
- Merge PR #648 from eaglegai: fix -q doesn't work when use with
'unbound-control stats_shm'.
17 March 2022: Wouter 17 March 2022: Wouter
- Fix to describe auth-zone and other configuration at the local-zone - Fix to describe auth-zone and other configuration at the local-zone
configuration option, to allow for more broadly view of the options. configuration option, to allow for more broadly view of the options.

View file

@ -444,7 +444,7 @@ static void do_stats_shm(struct config_file* cfg, struct ub_stats_info* stats,
#endif /* HAVE_SHMGET */ #endif /* HAVE_SHMGET */
/** print statistics from shm memory segment */ /** print statistics from shm memory segment */
static void print_stats_shm(const char* cfgfile) static void print_stats_shm(const char* cfgfile, int quiet)
{ {
#ifdef HAVE_SHMGET #ifdef HAVE_SHMGET
struct config_file* cfg; struct config_file* cfg;
@ -474,8 +474,11 @@ static void print_stats_shm(const char* cfgfile)
fatal_exit("shmat(%d): %s", id_arr, strerror(errno)); fatal_exit("shmat(%d): %s", id_arr, strerror(errno));
} }
/* print the stats */
do_stats_shm(cfg, stats, shm_stat); if (!quiet) {
/* print the stats */
do_stats_shm(cfg, stats, shm_stat);
}
/* shutdown */ /* shutdown */
shmdt(shm_stat); shmdt(shm_stat);
@ -987,7 +990,7 @@ int main(int argc, char* argv[])
#endif #endif
} }
if(argc >= 1 && strcmp(argv[0], "stats_shm")==0) { if(argc >= 1 && strcmp(argv[0], "stats_shm")==0) {
print_stats_shm(cfgfile); print_stats_shm(cfgfile, quiet);
return 0; return 0;
} }
check_args_for_listcmd(argc, argv); check_args_for_listcmd(argc, argv);