/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
+/* Define to 1 if you have the `vsyslog' function. */
+#undef HAVE_VSYSLOG
+
/* Define to 1 if you have the `wordexp' function. */
#undef HAVE_WORDEXP
as_fn_append ac_func_list " openat"
as_fn_append ac_func_list " faccessat"
as_fn_append ac_func_list " wordexp"
+as_fn_append ac_func_list " vsyslog"
as_fn_append ac_func_list " seteuid"
# Check that the precious variables saved in the cache have kept the same
# value.
+
+
case "$host_os" in
dnl Function checks
dnl
AC_FUNC_GETGROUPS
-AC_CHECK_FUNCS_ONCE([fexecve killpg nl_langinfo strftime pread pwrite openat faccessat wordexp])
+AC_CHECK_FUNCS_ONCE([fexecve killpg nl_langinfo strftime pread pwrite openat faccessat wordexp vsyslog])
case "$host_os" in
hpux*)
if test X"$ac_cv_func_pread" = X"yes"; then
static void
mysyslog(int pri, const char *fmt, ...)
{
- char *buf;
va_list ap;
debug_decl(mysyslog, SUDOERS_DEBUG_LOGGING)
va_start(ap, fmt);
openlog("sudo", 0, def_syslog);
- if (vasprintf(&buf, fmt, ap) == -1) {
- sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
- } else {
- syslog(pri, "%s", buf);
- free(buf);
- }
+#ifdef HAVE_VSYSLOG
+ vsyslog(pri, fmt, ap);
+#else
+ do {
+ char *buf;
+ if (vasprintf(&buf, fmt, ap) == -1) {
+ sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
+ } else {
+ syslog(pri, "%s", buf);
+ free(buf);
+ }
+ } while (0);
+#endif
va_end(ap);
closelog();
debug_return;