shared connections fixes
John (J5) Palmieri
johnp at redhat.com
Mon Oct 2 11:14:43 PDT 2006
On Sun, 2006-10-01 at 05:07 -0400, Havoc Pennington wrote:
> Index: dbus/dbus-internals.c
> ===================================================================
> RCS file: /cvs/dbus/dbus/dbus/dbus-internals.c,v
> retrieving revision 1.49
> diff -u -p -r1.49 dbus-internals.c
> --- dbus/dbus-internals.c 1 Oct 2006 03:18:47 -0000 1.49
> +++ dbus/dbus-internals.c 1 Oct 2006 09:03:54 -0000
> @@ -190,6 +190,9 @@
> */
> const char _dbus_no_memory_message[] = "Not enough memory";
>
> +static dbus_bool_t warn_initted = FALSE;
> +static dbus_bool_t fatal_warnings = FALSE;
> +
> /**
> * Prints a warning message to stderr.
> *
> @@ -199,12 +202,27 @@ void
> _dbus_warn (const char *format,
> ...)
> {
> - /* FIXME not portable enough? */
> va_list args;
>
> + if (!warn_initted)
> + {
> + const char *s;
> + s = _dbus_getenv ("DBUS_FATAL_WARNINGS");
> + if (s && *s)
> + fatal_warnings = TRUE;
> +
> + warn_initted = TRUE;
> + }
> +
> va_start (args, format);
> vfprintf (stderr, format, args);
> va_end (args);
> +
> + if (fatal_warnings)
> + {
> + fflush (stderr);
> + _dbus_abort ();
_dbus_abort is not defined if asserts are disabled but _dbus_warn is.
There are two ways we can deal with this. We can print out a warning
that DBUS_FATAL_WARNINGS only work if asserts are compiled in or we
could pull _dbus_abort out of the DBUS_DISABLE_ASSERT which opens up a
whole other can of worms because _dbus_print_backtrace I believe is also
wrapped in the macro. I assume just not aborting is fine since a user
would rarely ever want to abort on a warning but I thought I might check
first.
--
John (J5) Palmieri <johnp at redhat.com>
More information about the dbus
mailing list