diff options
author | Todd C. Miller <Todd.Miller@sudo.ws> | 2020-06-06 18:45:27 -0600 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@sudo.ws> | 2020-06-06 18:45:27 -0600 |
commit | e2b5dbbee3c066c55fd5de23d9ac9a954fedde6c (patch) | |
tree | 84809f3568cb8ac12ccfaf4a51dbd4eaa768b5ba | |
parent | 608da4bde4d71cd1424b5003223ab61052eefbbb (diff) | |
download | sudo-e2b5dbbee3c066c55fd5de23d9ac9a954fedde6c.tar.gz |
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.
-rw-r--r-- | config.h.in | 4 | ||||
-rwxr-xr-x | configure | 13 | ||||
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | include/sudo_compat.h | 5 |
4 files changed, 25 insertions, 2 deletions
diff --git a/config.h.in b/config.h.in index a05b4a11d..1799a02ff 100644 --- a/config.h.in +++ b/config.h.in @@ -98,6 +98,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 @@ -19380,6 +19380,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 diff --git a/configure.ac b/configure.ac index 20802a673..bd63e7310 100644 --- a/configure.ac +++ b/configure.ac @@ -2560,7 +2560,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" diff --git a/include/sudo_compat.h b/include/sudo_compat.h index 396e1cbbb..0388a860b 100644 --- a/include/sudo_compat.h +++ b/include/sudo_compat.h @@ -408,10 +408,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); |