2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

We still need the pread/pwrite hack for HP-UX 11.11 at least.

This time around, avoid defining _LARGEFILE64_SOURCE and just declare
pread64/pwrite64 ourselves.
This commit is contained in:
Todd C. Miller 2021-08-19 19:18:24 -06:00
parent 23e5304b78
commit ad28b90c4d
4 changed files with 70 additions and 3 deletions

View File

@ -153,6 +153,14 @@
don't. */
#undef HAVE_DECL_PATH_MAX
/* Define to 1 if you have the declaration of `pread64', and to 0 if you
don't. */
#undef HAVE_DECL_PREAD64
/* Define to 1 if you have the declaration of `pwrite64', and to 0 if you
don't. */
#undef HAVE_DECL_PWRITE64
/* Define to 1 if you have the declaration of `QUAD_MAX', and to 0 if you
don't. */
#undef HAVE_DECL_QUAD_MAX
@ -651,6 +659,9 @@
/* Define to 1 if you have the `pread' function. */
#undef HAVE_PREAD
/* Define to 1 if you have the `pread64' function. */
#undef HAVE_PREAD64
/* Define to 1 if you have the `priv_set' function. */
#undef HAVE_PRIV_SET
@ -678,6 +689,9 @@
/* Define to 1 if you have the `pwrite' function. */
#undef HAVE_PWRITE
/* Define to 1 if you have the `pwrite64' function. */
#undef HAVE_PWRITE64
/* Define to 1 if you have the `pw_dup' function. */
#undef HAVE_PW_DUP

38
configure vendored
View File

@ -20904,6 +20904,44 @@ if test "x$ac_cv_func_pread" = xyes
then :
printf "%s\n" "#define HAVE_PREAD 1" >>confdefs.h
# pread/pwrite on 32-bit HP-UX 11.x may not support large files
case "$host_os" in
hpux*|hiuxmpp*)
for ac_func in pread64 pwrite64
do :
as_ac_var=`printf "%s\n" "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"
then :
cat >>confdefs.h <<_ACEOF
#define `printf "%s\n" "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
ac_fn_check_decl "$LINENO" "pread64" "ac_cv_have_decl_pread64" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_pread64" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_PREAD64 $ac_have_decl" >>confdefs.h
ac_fn_check_decl "$LINENO" "pwrite64" "ac_cv_have_decl_pwrite64" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_pwrite64" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_PWRITE64 $ac_have_decl" >>confdefs.h
fi
done
;;
esac
else $as_nop
case " $LIBOBJS " in

View File

@ -2542,7 +2542,16 @@ dnl Function checks
dnl
AC_FUNC_GETGROUPS
AC_CHECK_FUNCS_ONCE([fexecve fmemopen killpg nl_langinfo faccessat wordexp getauxval fseeko])
AC_CHECK_FUNCS([pread], [], [
AC_CHECK_FUNCS([pread], [
# pread/pwrite on 32-bit HP-UX 11.x may not support large files
case "$host_os" in
hpux*|hiuxmpp*)
AC_CHECK_FUNCS([pread64 pwrite64], [
AC_CHECK_DECLS([pread64, pwrite64])
])
;;
esac
], [
AC_LIBOBJ(pread)
SUDO_APPEND_COMPAT_EXP(sudo_pread)
])

View File

@ -347,17 +347,23 @@ int getdomainname(char *, size_t);
#endif
/*
* HP-UX 11.00 has broken pread/pwrite that can't handle a 64-bit off_t
* on 32-bit machines.
* HP-UX 11.00 has broken pread/pwrite on 32-bit machines when
* _FILE_OFFSET_BITS == 64. Use pread64/pwrite64 instead.
*/
#if defined(__hpux) && !defined(__LP64__)
# ifdef HAVE_PREAD64
# undef pread
# define pread(_a, _b, _c, _d) pread64((_a), (_b), (_c), (_d))
# if defined(HAVE_DECL_PREAD64) && !HAVE_DECL_PREAD64
ssize_t pread64(int fd, void *buf, size_t nbytes, off64_t offset);
# endif
# endif
# ifdef HAVE_PWRITE64
# undef pwrite
# define pwrite(_a, _b, _c, _d) pwrite64((_a), (_b), (_c), (_d))
# if defined(HAVE_DECL_PWRITE64) && !HAVE_DECL_PWRITE64
ssize_t pwrite64(int fd, const void *buf, size_t nbytes, off64_t offset);
# endif
# endif
#endif /* __hpux && !__LP64__ */