From 6dabf652928007222b360ad3428c5b2977c26d88 Mon Sep 17 00:00:00 2001 From: eaglegai Date: Mon, 21 Mar 2022 14:11:54 +0800 Subject: [PATCH] fix -q doesn't work when use with 'unbound-control stats_shm' --- ...n-use-with-unbound-control-stats_shm.patch | 46 +++++++++++++++++++ unbound.spec | 12 ++++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 backport-fix-q-doesnt-work-when-use-with-unbound-control-stats_shm.patch diff --git a/backport-fix-q-doesnt-work-when-use-with-unbound-control-stats_shm.patch b/backport-fix-q-doesnt-work-when-use-with-unbound-control-stats_shm.patch new file mode 100644 index 0000000..243c81a --- /dev/null +++ b/backport-fix-q-doesnt-work-when-use-with-unbound-control-stats_shm.patch @@ -0,0 +1,46 @@ +From c60bed8eef8962c6f7d8deb266d438ff77baaaf5 Mon Sep 17 00:00:00 2001 +From: eaglegai +Date: Fri, 18 Mar 2022 19:08:02 +0800 +Subject: [PATCH] fix -q doesn't work when use with 'unbound-control stats_shm' + +Signed-off-by: eaglegai +--- + smallapp/unbound-control.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/smallapp/unbound-control.c b/smallapp/unbound-control.c +index c7c38276f..b0835e3e1 100644 +--- a/smallapp/unbound-control.c ++++ b/smallapp/unbound-control.c +@@ -444,7 +444,7 @@ static void do_stats_shm(struct config_file* cfg, struct ub_stats_info* stats, + #endif /* HAVE_SHMGET */ + + /** 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 + 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)); + } + +- /* print the stats */ +- do_stats_shm(cfg, stats, shm_stat); ++ ++ if (!quiet) { ++ /* print the stats */ ++ do_stats_shm(cfg, stats, shm_stat); ++ } + + /* shutdown */ + shmdt(shm_stat); +@@ -987,7 +990,7 @@ int main(int argc, char* argv[]) + #endif + } + if(argc >= 1 && strcmp(argv[0], "stats_shm")==0) { +- print_stats_shm(cfgfile); ++ print_stats_shm(cfgfile, quiet); + return 0; + } + check_args_for_listcmd(argc, argv); diff --git a/unbound.spec b/unbound.spec index b9c4645..d5b1ea4 100644 --- a/unbound.spec +++ b/unbound.spec @@ -2,7 +2,7 @@ Name: unbound Version: 1.13.2 -Release: 2 +Release: 3 Summary: Unbound is a validating, recursive, caching DNS resolver License: BSD Url: https://nlnetlabs.nl/projects/unbound/about/ @@ -21,6 +21,8 @@ Source11: unbound.sysconfig Source12: unbound-anchor.timer Source13: unbound-anchor.service +Patch0: backport-fix-q-doesnt-work-when-use-with-unbound-control-stats_shm.patch + BuildRequires: make flex swig pkgconfig systemd BuildRequires: libevent-devel expat-devel openssl-devel python3-devel BuildRequires: unbound-libs @@ -71,6 +73,8 @@ Package help includes includes man pages for unbound. pushd %{name}-%{version} +%autopatch -p1 + cp -pr doc pythonmod libunbound ../ popd @@ -223,6 +227,12 @@ popd %{_mandir}/man* %changelog +* Mon Mar 21 2022 gaihuiying - 1.13.2-3 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix -q doesn't work when use with 'unbound-control stats_shm' + * Wed Jan 26 2021 quanhongfei - 1.13.2-2 - Type:bugfix - ID:NA -- Gitee