summaryrefslogtreecommitdiff
path: root/dbus/dbus-sysdeps-util-unix.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-06-11 19:20:55 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-06-12 17:23:28 +0100
commit0553e53de04685588efacb961ae48384956db31d (patch)
tree945ae71aa2691aff6f92eb9196858e38bbb9951d /dbus/dbus-sysdeps-util-unix.c
parent51fe1c05aceaf058907007a25a2d46f30a9c83a6 (diff)
downloaddbus-0553e53de04685588efacb961ae48384956db31d.tar.gz
_dbus_system_logv: copy the va_list here too
This would crash if HAVE_SYSLOG_H is defined, HAVE_DECL_LOG_PERROR is false, and the platform calling convention is that va_list is a struct. Verified on Linux by undefining HAVE_DECL_LOG_PERROR. Reviewed-by: Colin Walters <walters@verbum.org>
Diffstat (limited to 'dbus/dbus-sysdeps-util-unix.c')
-rw-r--r--dbus/dbus-sysdeps-util-unix.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c
index 789729c7..6265e2b5 100644
--- a/dbus/dbus-sysdeps-util-unix.c
+++ b/dbus/dbus-sysdeps-util-unix.c
@@ -477,6 +477,7 @@ _dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...)
void
_dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args)
{
+ va_list tmp;
#ifdef HAVE_SYSLOG_H
int flags;
switch (severity)
@@ -494,14 +495,14 @@ _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args
return;
}
- vsyslog (flags, msg, args);
+ DBUS_VA_COPY (tmp, args);
+ vsyslog (flags, msg, tmp);
+ va_end (tmp);
#endif
#if !defined(HAVE_SYSLOG_H) || !HAVE_DECL_LOG_PERROR
{
/* vsyslog() won't write to stderr, so we'd better do it */
- va_list tmp;
-
DBUS_VA_COPY (tmp, args);
fprintf (stderr, "dbus[" DBUS_PID_FORMAT "]: ", _dbus_getpid ());
vfprintf (stderr, msg, tmp);