From: msweet Date: Thu, 20 Feb 2014 16:09:55 +0000 (+0000) Subject: Fix a D-BUS threading issue that caused the scheduler to crash (STR #4347) X-Git-Tag: v2.2b1~740 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cf0c416ec73f65d4631ec8e2b6409f95462c76e;p=thirdparty%2Fcups.git Fix a D-BUS threading issue that caused the scheduler to crash (STR #4347) Apparently D-BUS is not thread-safe by default... git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11626 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES-1.7.txt b/CHANGES-1.7.txt index 25d3a227e5..21abc9d47d 100644 --- a/CHANGES-1.7.txt +++ b/CHANGES-1.7.txt @@ -5,6 +5,8 @@ CHANGES IN CUPS V1.7.2 - Security: The scheduler now blocks URLs containing embedded HTML (STR #4356) + - Fixed a D-BUS threading issue that caused the scheduler to crash + (STR #4347) - The scheduler now automatically reconnects to Avahi as needed (STR #4370) - The scheduler did not handle GET requests for the log files properly diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4 index 0b66ac4676..6318b77f70 100644 --- a/config-scripts/cups-common.m4 +++ b/config-scripts/cups-common.m4 @@ -3,7 +3,7 @@ dnl "$Id$" dnl dnl Common configuration stuff for CUPS. dnl -dnl Copyright 2007-2013 by Apple Inc. +dnl Copyright 2007-2014 by Apple Inc. dnl Copyright 1997-2007 by Easy Software Products, all rights reserved. dnl dnl These coded instructions, statements, and computer programs are the @@ -304,16 +304,11 @@ fi LIBS="$SAVELIBS" dnl Check for DBUS support -if test -d /etc/dbus-1; then - DBUSDIR="/etc/dbus-1" -else - DBUSDIR="" -fi - AC_ARG_ENABLE(dbus, [ --disable-dbus build without DBUS support]) AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ], DBUSDIR="$withval") +DBUSDIR="" DBUS_NOTIFIER="" DBUS_NOTIFIERLIBS="" @@ -330,7 +325,12 @@ if test "x$enable_dbus" != xno -a "x$PKGCONFIG" != x; then LIBS="$LIBS $DBUS_NOTIFIERLIBS" AC_CHECK_FUNC(dbus_message_iter_init_append, AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND)) + AC_CHECK_FUNC(dbus_threads_init, + AC_DEFINE(HAVE_DBUS_THREADS_INIT)) LIBS="$SAVELIBS" + if test -d /etc/dbus-1; then + DBUSDIR="/etc/dbus-1" + fi else AC_MSG_RESULT(no) fi diff --git a/config.h.in b/config.h.in index 7c96248f86..1b2df157ef 100644 --- a/config.h.in +++ b/config.h.in @@ -535,6 +535,7 @@ #undef HAVE_DBUS #undef HAVE_DBUS_MESSAGE_ITER_INIT_APPEND +#undef HAVE_DBUS_THREADS_INIT /* diff --git a/scheduler/main.c b/scheduler/main.c index 7ed396d61e..f847e275c8 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -477,6 +477,14 @@ main(int argc, /* I - Number of command-line args */ setlocale(LC_TIME, ""); #endif /* LC_TIME */ +#ifdef HAVE_DBUS_THREADS_INIT + /* + * Enable threading support for D-BUS... + */ + + dbus_threads_init(); +#endif /* HAVE_DBUS_THREADS_INIT */ + /* * Set the maximum number of files... */