diff options
-rw-r--r-- | src/shared/util.h | 9 |
1 files 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); |