From 10647c881b4d2740a226cb954cf4b91c6e462907 Mon Sep 17 00:00:00 2001 From: "Anthony G. Basile" Date: Wed, 27 May 2015 12:42:05 -0400 Subject: src/shared/util.h: update qsort_safe() for musl Signed-off-by: Anthony G. Basile --- src/shared/util.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/shared/util.h b/src/shared/util.h index 423210e2f0..e9178b9bd3 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -386,10 +386,11 @@ int unlink_noerrno(const char *path); static inline void qsort_safe(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { - if (nmemb) { - assert(base); - qsort(base, nmemb, size, compar); - } + if (nmemb <= 1) + return; + + assert(base); + qsort(base, nmemb, size, compar); } int proc_cmdline(char **ret); -- cgit v1.2.3-54-g00ecf