Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
build-aux/syntax-check.mk | 7 +++++++
tools/nss/libvirt_nss.c | 3 ++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index 309ca0c29a..462bff72f8 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -248,6 +248,13 @@ sc_prohibit_canonicalize_file_name:
halt='use virFileCanonicalizePath() instead of canonicalize_file_name()' \
$(_sc_search_regexp)
+# qsort from glibc is unstable. Use g_qsort_with_data from glib instead
+sc_prohibit_qsort:
+ @prohibit='\<qsort\(' \
+ exclude='exempt from syntax-check' \
+ halt='use g_qsort_with_data instead of qsort' \
+ $(_sc_search_regexp)
+
# Insist on correct types for [pug]id.
sc_correct_id_types:
@prohibit='\<(int|long) *[pug]id\>' \
diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index ff6ea1d373..d79a00a1b0 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -71,7 +71,8 @@ sortAddr(leaseAddress *tmpAddress,
size_t ntmpAddress)
{
if (tmpAddress)
- qsort(tmpAddress, ntmpAddress, sizeof(*tmpAddress), leaseAddressSorter);
+ qsort(tmpAddress, ntmpAddress, /* exempt from syntax-check */
+ sizeof(*tmpAddress), leaseAddressSorter);
}
--
2.41.0