Use mkdtempat_np() and mkostempsat_np() on macOS
This commit is contained in:
10
config.h.in
10
config.h.in
@@ -602,17 +602,17 @@
|
||||
/* Define to 1 if you have the `mkdirat' function. */
|
||||
#undef HAVE_MKDIRAT
|
||||
|
||||
/* Define to 1 if you have the `mkdtemp' function. */
|
||||
#undef HAVE_MKDTEMP
|
||||
|
||||
/* Define to 1 if you have the `mkdtempat' function. */
|
||||
#undef HAVE_MKDTEMPAT
|
||||
|
||||
/* Define to 1 if you have the `mkdtempat_np' function. */
|
||||
#undef HAVE_MKDTEMPAT_NP
|
||||
|
||||
/* Define to 1 if you have the `mkostempsat' function. */
|
||||
#undef HAVE_MKOSTEMPSAT
|
||||
|
||||
/* Define to 1 if you have the `mkstemps' function. */
|
||||
#undef HAVE_MKSTEMPS
|
||||
/* Define to 1 if you have the `mkostempsat_np' function. */
|
||||
#undef HAVE_MKOSTEMPSAT_NP
|
||||
|
||||
/* Define to 1 if you have the <mps/ldap_ssl.h> header file. */
|
||||
#undef HAVE_MPS_LDAP_SSL_H
|
||||
|
25
configure
vendored
25
configure
vendored
@@ -23338,8 +23338,11 @@ fi
|
||||
|
||||
done
|
||||
sudo_mktemp=no
|
||||
case "$host_os" in
|
||||
darwin*)
|
||||
# macOS has these but uses a _np (non-portable) suffix
|
||||
|
||||
for ac_func in mkdtempat mkostempsat mkstemps mkdtemp
|
||||
for ac_func in mkdtempat_np mkostempsat_np
|
||||
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"
|
||||
@@ -23354,6 +23357,26 @@ else $as_nop
|
||||
fi
|
||||
|
||||
done
|
||||
;;
|
||||
*)
|
||||
|
||||
for ac_func in mkdtempat mkostempsat
|
||||
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
|
||||
|
||||
else $as_nop
|
||||
sudo_mktemp=yes; break
|
||||
fi
|
||||
|
||||
done
|
||||
;;
|
||||
esac
|
||||
# If any of the mktemp family are missing we use our own.
|
||||
if test X"$sudo_mktemp" = X"yes"; then
|
||||
|
||||
|
10
configure.ac
10
configure.ac
@@ -2962,7 +2962,15 @@ AC_CHECK_FUNCS([closefrom], [], [AC_LIBOBJ(closefrom)
|
||||
COMPAT_TEST_PROGS="${COMPAT_TEST_PROGS}${COMPAT_TEST_PROGS+ }closefrom_test"
|
||||
])
|
||||
sudo_mktemp=no
|
||||
AC_CHECK_FUNCS([mkdtempat mkostempsat mkstemps mkdtemp], [], [sudo_mktemp=yes; break])
|
||||
case "$host_os" in
|
||||
darwin*)
|
||||
# macOS has these but uses a _np (non-portable) suffix
|
||||
AC_CHECK_FUNCS([mkdtempat_np mkostempsat_np], [], [sudo_mktemp=yes; break])
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_FUNCS([mkdtempat mkostempsat], [], [sudo_mktemp=yes; break])
|
||||
;;
|
||||
esac
|
||||
# If any of the mktemp family are missing we use our own.
|
||||
if test X"$sudo_mktemp" = X"yes"; then
|
||||
AC_CHECK_FUNCS([arc4random random lrand48], [break])
|
||||
|
@@ -499,23 +499,30 @@ sudo_dso_public int sudo_mkdirat(int dfd, const char *path, mode_t mode);
|
||||
# undef mkdirat
|
||||
# define mkdirat(_a, _b, _c) sudo_mkdirat((_a), (_b), (_c))
|
||||
#endif /* HAVE_MKDIRAT */
|
||||
#if !defined(HAVE_MKDTEMP) || !defined(HAVE_MKDTEMPAT) || !defined(HAVE_MKOSTEMPSAT) || !defined(HAVE_MKSTEMPS)
|
||||
#if !defined(HAVE_MKDTEMPAT) || !defined(HAVE_MKOSTEMPSAT)
|
||||
# if defined(HAVE_MKDTEMPAT_NP) && defined(HAVE_MKOSTEMPSAT_NP)
|
||||
# undef mkdtempat
|
||||
# define mkdtempat mkdtempat_np
|
||||
# undef mkostempsat
|
||||
# define mkostempsat mkostempsat_np
|
||||
# else
|
||||
sudo_dso_public char *sudo_mkdtemp(char *path);
|
||||
# undef mkdtemp
|
||||
# define mkdtemp(_a) sudo_mkdtemp((_a))
|
||||
# undef mkdtemp
|
||||
# define mkdtemp(_a) sudo_mkdtemp((_a))
|
||||
sudo_dso_public char *sudo_mkdtempat(int dfd, char *path);
|
||||
# undef mkdtempat
|
||||
# define mkdtempat(_a, _b) sudo_mkdtempat((_a), (_b))
|
||||
# undef mkdtempat
|
||||
# define mkdtempat(_a, _b) sudo_mkdtempat((_a), (_b))
|
||||
sudo_dso_public int sudo_mkostempsat(int dfd, char *path, int slen, int flags);
|
||||
# undef mkostempsat
|
||||
# define mkostempsat(_a, _b, _c, _d) sudo_mkostempsat((_a), (_b), (_c), (_d))
|
||||
# undef mkostempsat
|
||||
# define mkostempsat(_a, _b, _c, _d) sudo_mkostempsat((_a), (_b), (_c), (_d))
|
||||
sudo_dso_public int sudo_mkstemp(char *path);
|
||||
# undef mkstemp
|
||||
# define mkstemp(_a) sudo_mkstemp((_a))
|
||||
# undef mkstemp
|
||||
# define mkstemp(_a) sudo_mkstemp((_a))
|
||||
sudo_dso_public int sudo_mkstemps(char *path, int slen);
|
||||
# undef mkstemps
|
||||
# define mkstemps(_a, _b) sudo_mkstemps((_a), (_b))
|
||||
#endif /* !HAVE_MKDTEMP || !HAVE_MKDTEMPAT || !HAVE_MKOSTEMPSAT || !HAVE_MKSTEMPS */
|
||||
# undef mkstemps
|
||||
# define mkstemps(_a, _b) sudo_mkstemps((_a), (_b))
|
||||
# endif /* HAVE_MKDTEMPAT_NP || HAVE_MKOSTEMPSAT_NP */
|
||||
#endif /* !HAVE_MKDTEMPAT || !HAVE_MKOSTEMPSAT */
|
||||
#ifndef HAVE_NANOSLEEP
|
||||
sudo_dso_public int sudo_nanosleep(const struct timespec *timeout, struct timespec *remainder);
|
||||
#undef nanosleep
|
||||
|
@@ -24,7 +24,8 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if !defined(HAVE_MKDTEMP) || !defined(HAVE_MKDTEMPAT) || !defined(HAVE_MKOSTEMPSAT) || !defined(HAVE_MKSTEMPS)
|
||||
#if (!defined(HAVE_MKDTEMPAT) && !defined(HAVE_MKDTEMPAT_NP)) || \
|
||||
(!defined(HAVE_MKOSTEMPSAT) && !defined(HAVE_MKOSTEMPSAT_NP))
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
@@ -168,4 +169,4 @@ sudo_mkstemps(char *path, int slen)
|
||||
{
|
||||
return mktemp_internal(AT_FDCWD, path, slen, MKTEMP_FILE, 0);
|
||||
}
|
||||
#endif /* !HAVE_MKDTEMP || !HAVE_MKDTEMPAT || !HAVE_MKOSTEMPSAT || !HAVE_MKSTEMPS */
|
||||
#endif /* !HAVE_MKDTEMPAT || !HAVE_MKOSTEMPSAT */
|
||||
|
Reference in New Issue
Block a user