+diff --git a/wvmodemscan.cc b/wvmodemscan.cc
+index ef5ab87..f97581e 100644
+--- a/wvmodemscan.cc
++++ b/wvmodemscan.cc
+@@ -503,11 +503,16 @@ static int fileselect(const struct dirent *e)
+ #endif
+ }
+
+-
++#if defined(__GLIBC__) && __GLIBC_PREREQ(2, 10)
++static int filesort(const struct dirent **e1, const struct dirent **e2)
++#else
+ static int filesort(const void *_e1, const void *_e2)
++#endif
+ {
++#if !(defined(__GLIBC__) && __GLIBC_PREREQ(2, 10))
+ dirent const * const *e1 = (dirent const * const *)_e1;
+ dirent const * const *e2 = (dirent const * const *)_e2;
++#endif
+ const char *p1, *p2;
+ int diff;
+