@@ -87,7 +87,7 @@ AC_CHECK_DECL([PRIdMAX],,
dnl Checks for library functions.
AC_CHECK_FUNCS(bsearch faccessat getpwnam getrlimit isalpha killpg \
- memfd_create mempcpy \
+ memfd_create memrchr mempcpy \
sigsetmask stpcpy strchrnul strsignal strtod strtoimax \
strtoumax sysconf tee)
@@ -1684,7 +1684,11 @@ static char *expmeta(char *name, unsigned name_len, size_t expdir_len)
cp = addfnamealt(enddir, expdir_len);
goto out_opendir;
}
+#ifdef HAVE_MEMRCHR
start = memrchr(name, '/', p - name);
+#else
+ start = strrchr(name, '/');
+#endif
if (start) {
c = *++start;
*start = 0;