summaryrefslogtreecommitdiff
path: root/test/stdlib/qsort.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/stdlib/qsort.c')
-rw-r--r--test/stdlib/qsort.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/stdlib/qsort.c b/test/stdlib/qsort.c
index abc505e2d..74f93315f 100644
--- a/test/stdlib/qsort.c
+++ b/test/stdlib/qsort.c
@@ -34,7 +34,15 @@ int main(void)
printf("[%d] %s\n", i, dirbuf->d_name);
}
printf("\nCalling qsort()\n");
- qsort(array, numdir, sizeof(struct dirent *), alphasort);
+ /* Even though some manpages say that alphasort should be
+ * int alphasort(const void *a, const void *b),
+ * in reality glibc and uclibc have const struct dirent**
+ * instead of const void*.
+ * Therefore we get a warning here unless we use a cast,
+ * which makes people think that alphasort prototype
+ * needs to be fixed in uclibc headers.
+ */
+ qsort(array, numdir, sizeof(struct dirent *), (void*) alphasort);
for (i = 0; i < numdir; ++i) {
dirbuf = array[i];
printf("[%d] %s\n", i, dirbuf->d_name);