Declare getdelim(3) if it exists in libc but is not prototyped in stdio.h.

This can happen on systems with a gcc packages that was built on
and older versions of the OS where getdelim(3) was not present.
This commit is contained in:
Todd C. Miller
2020-06-06 18:45:27 -06:00
parent 17b3f90f74
commit 48c2bd0007
4 changed files with 25 additions and 2 deletions

View File

@@ -107,6 +107,10 @@
*/
#undef HAVE_DECL_ERRNO
/* Define to 1 if you have the declaration of `getdelim', and to 0 if you
don't. */
#undef HAVE_DECL_GETDELIM
/* Define to 1 if you have the declaration of `getdomainname', and to 0 if you
don't. */
#undef HAVE_DECL_GETDOMAINNAME

13
configure vendored
View File

@@ -19901,6 +19901,19 @@ if test "x$ac_cv_func_getdelim" = xyes; then :
#define HAVE_GETDELIM 1
_ACEOF
# Out of date gcc fixed includes may result in missing getdelim() prototype
ac_fn_c_check_decl "$LINENO" "getdelim" "ac_cv_have_decl_getdelim" "$ac_includes_default"
if test "x$ac_cv_have_decl_getdelim" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_GETDELIM $ac_have_decl
_ACEOF
else
case " $LIBOBJS " in

View File

@@ -2680,7 +2680,10 @@ AC_CHECK_FUNCS([getgrouplist], [], [
esac
SUDO_APPEND_COMPAT_EXP(sudo_getgrouplist)
])
AC_CHECK_FUNCS([getdelim], [], [
AC_CHECK_FUNCS([getdelim], [
# Out of date gcc fixed includes may result in missing getdelim() prototype
AC_CHECK_DECLS([getdelim])
], [
AC_LIBOBJ(getdelim)
SUDO_APPEND_COMPAT_EXP(sudo_getdelim)
COMPAT_TEST_PROGS="${COMPAT_TEST_PROGS}${COMPAT_TEST_PROGS+ }getdelim_test"

View File

@@ -446,10 +446,13 @@ __dso_public int sudo_getgrouplist(const char *name, GETGROUPS_T basegid, GETGRO
# undef getgrouplist
# define getgrouplist(_a, _b, _c, _d) sudo_getgrouplist((_a), (_b), (_c), (_d))
#endif /* GETGROUPLIST */
#ifndef HAVE_GETDELIM
#if !defined(HAVE_GETDELIM)
__dso_public ssize_t sudo_getdelim(char **bufp, size_t *bufsizep, int delim, FILE *fp);
# undef getdelim
# define getdelim(_a, _b, _c, _d) sudo_getdelim((_a), (_b), (_c), (_d))
#elif defined(HAVE_DECL_GETDELIM) && !HAVE_DECL_GETDELIM
/* getdelim present in libc but missing prototype (old gcc fixed includes?) */
ssize_t getdelim(char **bufp, size_t *bufsizep, int delim, FILE *fp);
#endif /* HAVE_GETDELIM */
#ifndef HAVE_GETUSERSHELL
__dso_public char *sudo_getusershell(void);