]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
_dbus_verbose_real: Use the Python convention for quoting potentially multi-line...
authorRalf Habacker <ralf.habacker@freenet.de>
Mon, 27 Apr 2020 12:01:30 +0000 (12:01 +0000)
committerRalf Habacker <ralf.habacker@freenet.de>
Mon, 27 Apr 2020 12:01:30 +0000 (12:01 +0000)
dbus/dbus-internals.c
dbus/dbus-sysdeps-win.c

index 57b8cea7b71de49e078406c2cb1550c2eab6078c..ab498b1592b37e754dfc9a52e6b060eb8d0feaae 100644 (file)
@@ -475,9 +475,9 @@ _dbus_verbose_real (
 out:
     if (message == NULL)
       {
-        OutputDebugStringA ("Out of memory while formatting verbose message: '");
+        OutputDebugStringA ("Out of memory while formatting verbose message: '''");
         OutputDebugStringA (format);
-        OutputDebugStringA ("'");
+        OutputDebugStringA ("'''");
       }
     else
       {
index de7d4d59bc429d8c4a5e2d332555b193d67ad23b..318bd360142990d81f2a7dcd517c396d4dbb29a4 100644 (file)
@@ -3848,14 +3848,31 @@ _dbus_logv (DBusSystemLogSeverity  severity,
 
   if (log_flags & DBUS_LOG_FLAGS_SYSTEM_LOG)
     {
-      char buf[1024];
-      char format[1024];
-
+      DBusString out = _DBUS_STRING_INIT_INVALID;
+      const char *message = NULL;
       DBUS_VA_COPY (tmp, args);
-      snprintf (format, sizeof (format), "%s: %s", s, msg);
-      vsnprintf(buf, sizeof(buf), format, tmp);
-      OutputDebugStringA(buf);
+
+      if (!_dbus_string_init (&out))
+        goto out;
+      if (!_dbus_string_append_printf (&out, "%s: ", s))
+        goto out;
+      if (!_dbus_string_append_printf_valist (&out, msg, tmp))
+        goto out;
+      message = _dbus_string_get_const_data (&out);
+out:
+      if (message != NULL)
+        {
+          OutputDebugStringA (message);
+        }
+      else
+        {
+          OutputDebugStringA ("Out of memory while formatting message: '''");
+          OutputDebugStringA (msg);
+          OutputDebugStringA ("'''");
+        }
+
       va_end (tmp);
+      _dbus_string_free (&out);
     }
 
   if (log_flags & DBUS_LOG_FLAGS_STDERR)