mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-04 00:05:11 +00:00
If a system lacks mkdtemp() or mkstemps(), use our own mkdtemp()
and mkstemps(). Previously we only exposed the missing one but since the guts are the same we might as well use them.
This commit is contained in:
15
configure
vendored
15
configure
vendored
@@ -18395,6 +18395,8 @@ if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
|||||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
|
else
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -18417,22 +18419,13 @@ done
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test X"$ac_cv_func_mkstemps" = X"no"; then
|
# If either mkdtemp() or mkstemps() is missing, replace both.
|
||||||
|
|
||||||
for _sym in sudo_mkstemps; do
|
for _sym in sudo_mkdtemp sudo_mkstemps; do
|
||||||
COMPAT_EXP="${COMPAT_EXP}${_sym}
|
COMPAT_EXP="${COMPAT_EXP}${_sym}
|
||||||
"
|
"
|
||||||
done
|
done
|
||||||
|
|
||||||
fi
|
|
||||||
if test X"$ac_cv_func_mkdtemp" = X"no"; then
|
|
||||||
|
|
||||||
for _sym in sudo_mkdtemp; do
|
|
||||||
COMPAT_EXP="${COMPAT_EXP}${_sym}
|
|
||||||
"
|
|
||||||
done
|
|
||||||
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
for ac_func in snprintf vsnprintf
|
for ac_func in snprintf vsnprintf
|
||||||
do :
|
do :
|
||||||
|
10
configure.ac
10
configure.ac
@@ -2518,16 +2518,12 @@ AC_CHECK_FUNCS(closefrom, [], [AC_LIBOBJ(closefrom)
|
|||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
# include <fcntl.h> ])
|
# include <fcntl.h> ])
|
||||||
])
|
])
|
||||||
AC_CHECK_FUNCS(mkstemps mkdtemp)
|
AC_CHECK_FUNCS(mkstemps mkdtemp, [], [break])
|
||||||
if test X"$ac_cv_func_mkstemps$ac_cv_func_mkdtemp" != X"yesyes"; then
|
if test X"$ac_cv_func_mkstemps$ac_cv_func_mkdtemp" != X"yesyes"; then
|
||||||
AC_CHECK_FUNCS(random lrand48, [break])
|
AC_CHECK_FUNCS(random lrand48, [break])
|
||||||
AC_LIBOBJ(mktemp)
|
AC_LIBOBJ(mktemp)
|
||||||
if test X"$ac_cv_func_mkstemps" = X"no"; then
|
# If either mkdtemp() or mkstemps() is missing, replace both.
|
||||||
SUDO_APPEND_COMPAT_EXP(sudo_mkstemps)
|
SUDO_APPEND_COMPAT_EXP(sudo_mkdtemp sudo_mkstemps)
|
||||||
fi
|
|
||||||
if test X"$ac_cv_func_mkdtemp" = X"no"; then
|
|
||||||
SUDO_APPEND_COMPAT_EXP(sudo_mkdtemp)
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
AX_FUNC_SNPRINTF
|
AX_FUNC_SNPRINTF
|
||||||
if test X"$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf" = X"yesyes"; then
|
if test X"$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf" = X"yesyes"; then
|
||||||
|
@@ -433,16 +433,14 @@ __dso_public errno_t sudo_memset_s(void *v, rsize_t smax, int c, rsize_t n);
|
|||||||
# undef memset_s
|
# undef memset_s
|
||||||
# define memset_s(_a, _b, _c, _d) sudo_memset_s((_a), (_b), (_c), (_d))
|
# define memset_s(_a, _b, _c, _d) sudo_memset_s((_a), (_b), (_c), (_d))
|
||||||
#endif /* HAVE_MEMSET_S */
|
#endif /* HAVE_MEMSET_S */
|
||||||
#ifndef HAVE_MKDTEMP
|
#if !defined(HAVE_MKDTEMP) || !defined(HAVE_MKSTEMPS)
|
||||||
__dso_public char *sudo_mkdtemp(char *path);
|
__dso_public char *sudo_mkdtemp(char *path);
|
||||||
# undef mkdtemp
|
# undef mkdtemp
|
||||||
# define mkdtemp(_a) sudo_mkdtemp((_a))
|
# define mkdtemp(_a) sudo_mkdtemp((_a))
|
||||||
#endif /* HAVE_MKDTEMP */
|
|
||||||
#ifndef HAVE_MKSTEMPS
|
|
||||||
__dso_public int sudo_mkstemps(char *path, int slen);
|
__dso_public int sudo_mkstemps(char *path, int slen);
|
||||||
# undef mkstemps
|
# undef mkstemps
|
||||||
# define mkstemps(_a, _b) sudo_mkstemps((_a), (_b))
|
# define mkstemps(_a, _b) sudo_mkstemps((_a), (_b))
|
||||||
#endif /* HAVE_MKSTEMPS */
|
#endif /* !HAVE_MKDTEMP || !HAVE_MKSTEMPS */
|
||||||
#ifndef HAVE_PW_DUP
|
#ifndef HAVE_PW_DUP
|
||||||
__dso_public struct passwd *sudo_pw_dup(const struct passwd *pw);
|
__dso_public struct passwd *sudo_pw_dup(const struct passwd *pw);
|
||||||
# undef pw_dup
|
# undef pw_dup
|
||||||
|
@@ -142,15 +142,12 @@ mktemp_internal(char *path, int slen, int mode)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_MKSTEMPS
|
|
||||||
int
|
int
|
||||||
sudo_mkstemps(char *path, int slen)
|
sudo_mkstemps(char *path, int slen)
|
||||||
{
|
{
|
||||||
return mktemp_internal(path, slen, MKTEMP_FILE);
|
return mktemp_internal(path, slen, MKTEMP_FILE);
|
||||||
}
|
}
|
||||||
#endif /* HAVE_MKSTEMPS */
|
|
||||||
|
|
||||||
#ifndef HAVE_MKDTEMP
|
|
||||||
char *
|
char *
|
||||||
sudo_mkdtemp(char *path)
|
sudo_mkdtemp(char *path)
|
||||||
{
|
{
|
||||||
@@ -158,5 +155,4 @@ sudo_mkdtemp(char *path)
|
|||||||
return NULL;
|
return NULL;
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_MKDTEMP */
|
|
||||||
#endif /* !HAVE_MKSTEMPS || !HAVE_MKDTEMP */
|
#endif /* !HAVE_MKSTEMPS || !HAVE_MKDTEMP */
|
||||||
|
Reference in New Issue
Block a user