diff options
202 files changed, 1431 insertions, 656 deletions
@@ -1,12 +1,13 @@ D-Bus is licensed to you under your choice of the Academic Free -License version 2.1, or the GNU General Public License version 2. +License version 2.1, or the GNU General Public License version 2 +(or, at your option any later version). + Both licenses are included here. Some of the standalone binaries are under the GPL only; in particular, but not limited to, tools/dbus-cleanup-sockets.c and test/decode-gcov.c. Each source code file is marked with the proper copyright information - if you find a file that isn't marked please bring it to our attention. - The Academic Free License v. 2.1 @@ -212,7 +213,7 @@ START OF GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -516,7 +517,7 @@ the "copyright" line and a pointer to where the full notice is found. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. @@ -59,12 +59,95 @@ Coding Style data). Avoiding heuristics is also important for security reasons; if it looks funny, ignore it (or exit, or disconnect). +Development +=== + +D-Bus uses Git as its version control system. The main repository is +hosted at git.freedesktop.org/dbus/dbus. To clone D-Bus, execute the +following command: + + git clone git://git.freedesktop.org/dbus/dbus +OR + git clone git.freedesktop.org:dbus/dbus + +The latter form is the one that allows pushing, but it also requires +an SSH account on the server. The former form allows anonymous +checkouts. + +D-Bus development happens in two branches in parallel: the current +stable branch, with an even minor number (like 1.0, 1.2 and 1.4), and +the next development branch, with the next odd number. + +The stable branch is named after the version number itself (dbus-1.2, +dbus-1.4), whereas the development branch is simply known as "master". + +When making a change to D-Bus, do the following: + + - check out the earliest branch of D-Bus that makes sense to have + your change in. If it's a bugfix, it's normally the current stable + branch; if it's a feature, it's normally the "master" branch. If + you have an important security fix, you may want to apply to older + branches too. + + - for large changes: + if you're developing a new, large feature, it's recommended + to create a new branch and do your development there. Publish + your branch at a suitable place and ask others to help you + develop and test it. Once your feature is considered finalised, + you may merge it into the "master" branch. + +- for small changes: + . make your change to the source code + . execute tests to guarantee that you're not introducing a + regression. For that, execute: make check + (if possible, add a new test to check the fix you're + introducing) + . commit your change using "git commit" + in the commit message, write a short sentence describing what + you did in the first line. Then write a longer description in + the next paragraph(s). + . repeat the previous steps if necessary to have multiple commits + + - extract your patches and send to the D-Bus mailing list for + review or post them to the D-Bus Bugzilla, attaching them to a bug + report. To extract the patches, execute: + git format-patch origin/master + + - once your code has been reviewed, you may push it to the Git + server: + git push origin my-branch:remote + OR + git push origin dbus-X.Y + OR + git push origin master + (consult the Git manual to know which command applies) + + - (Optional) if you've not worked on "master", merge your changes to + that branch. If you've worked on an earlier branch than the current + stable, merge your changes upwards towards the stable branch, then + from there into "master". + + . execute: git checkout master + . ensure that you have the latest "master" from the server, update + if you don't + . execute: git merge dbus-X.Y + . if you have any conflicts, resolve them, git add the conflicted + files and then git commit + . push the "master" branch to the server as well + + Executing this merge is recommended, but not necessary for all + changes. You should do this step if your bugfix is critical for the + development in "master", or if you suspect that conflicts will arise + (you're usually the best person to resolve conflicts introduced by + your own code), or if it has been too long since the last merge. + + Making a release === To make a release of D-Bus, do the following: - - check out a fresh copy from CVS + - check out a fresh copy from Git - verify that the libtool versioning/library soname is changed if it needs to be, or not changed if not @@ -85,21 +168,24 @@ To make a release of D-Bus, do the following: - if make distcheck fails, fix it. - - once distcheck succeeds, "git-commit -a". This is the version + - once distcheck succeeds, "git commit -a". This is the version of the tree that corresponds exactly to the released tarball. - - tag the tree with "git-tag -s -m 'Released X.Y.Z' dbus-X.Y.Z" + - tag the tree with "git tag -s -m 'Released X.Y.Z' dbus-X.Y.Z" where X.Y.Z is the version of the release. If you can't sign - then simply created an unannotated tag: "git-tag dbus-X.Y.Z". + then simply created an unannotated tag: "git tag dbus-X.Y.Z". - bump the version number up in configure.in, and commit it. Make sure you do this *after* tagging the previous release! The idea is that git has a newer version number than anything released. - - push your changes to the central repository with "git-push" + - merge the branch you've released to the chronologically-later + branch (usually "master"). You'll probably have to fix a merge + conflict in configure.in (the version number). - - push your new tag, too: "git-push origin dbus-X.Y.Z" + - push your changes and the tag to the central repository with + git push origin master dbus-X.Y dbus-X.Y.Z - scp your tarball to freedesktop.org server and copy it to /srv/dbus.freedesktop.org/www/releases/dbus. This should diff --git a/bus/activation-exit-codes.h b/bus/activation-exit-codes.h index af6952e9..bbb98dca 100644 --- a/bus/activation-exit-codes.h +++ b/bus/activation-exit-codes.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/activation-helper-bin.c b/bus/activation-helper-bin.c index 4a359726..a360acc7 100644 --- a/bus/activation-helper-bin.c +++ b/bus/activation-helper-bin.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/activation-helper.c b/bus/activation-helper.c index 36006a4c..baba8f04 100644 --- a/bus/activation-helper.c +++ b/bus/activation-helper.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/activation-helper.h b/bus/activation-helper.h index aee50108..361a4c6a 100644 --- a/bus/activation-helper.h +++ b/bus/activation-helper.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/activation.c b/bus/activation.c index a273c4ad..782ffed8 100644 --- a/bus/activation.c +++ b/bus/activation.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "activation.h" diff --git a/bus/activation.h b/bus/activation.h index 56e22836..2dff812a 100644 --- a/bus/activation.h +++ b/bus/activation.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/config-loader-expat.c b/bus/config-loader-expat.c index 4b29f32b..c0620aed 100644 --- a/bus/config-loader-expat.c +++ b/bus/config-loader-expat.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/config-loader-libxml.c b/bus/config-loader-libxml.c index 2c323c75..3d82a633 100644 --- a/bus/config-loader-libxml.c +++ b/bus/config-loader-libxml.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/config-parser-common.c b/bus/config-parser-common.c index 5cdbba26..ebcb7177 100644 --- a/bus/config-parser-common.c +++ b/bus/config-parser-common.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/config-parser-common.h b/bus/config-parser-common.h index 2c296433..dc0e0eda 100644 --- a/bus/config-parser-common.h +++ b/bus/config-parser-common.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/config-parser-trivial.c b/bus/config-parser-trivial.c index 98d554e8..fd016a84 100644 --- a/bus/config-parser-trivial.c +++ b/bus/config-parser-trivial.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/config-parser-trivial.h b/bus/config-parser-trivial.h index bb760dd5..ce542bfb 100644 --- a/bus/config-parser-trivial.h +++ b/bus/config-parser-trivial.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/config-parser.c b/bus/config-parser.c index 784c8315..a4a01914 100644 --- a/bus/config-parser.c +++ b/bus/config-parser.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "config-parser-common.h" @@ -448,7 +448,7 @@ bus_config_parser_new (const DBusString *basedir, */ parser->limits.max_match_rules_per_connection = 512; - parser->limits.reply_timeout = 5 * 60 * 1000; /* 5 minutes */ + parser->limits.reply_timeout = -1; /* never */ /* this is effectively a limit on message queue size for messages * that require a reply diff --git a/bus/config-parser.h b/bus/config-parser.h index bb3a30f4..3aac1ed3 100644 --- a/bus/config-parser.h +++ b/bus/config-parser.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/connection.c b/bus/connection.c index 9159c898..50807f1a 100644 --- a/bus/connection.c +++ b/bus/connection.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "connection.h" diff --git a/bus/connection.h b/bus/connection.h index 4f352169..4b9a754b 100644 --- a/bus/connection.h +++ b/bus/connection.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/desktop-file.c b/bus/desktop-file.c index e925b2ea..9f88d6e7 100644 --- a/bus/desktop-file.c +++ b/bus/desktop-file.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include <dbus/dbus-sysdeps.h> diff --git a/bus/desktop-file.h b/bus/desktop-file.h index 549f89a4..7f43458a 100644 --- a/bus/desktop-file.h +++ b/bus/desktop-file.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef BUS_DESKTOP_FILE_H diff --git a/bus/dir-watch-default.c b/bus/dir-watch-default.c index 927f6721..6f8f1e99 100644 --- a/bus/dir-watch-default.c +++ b/bus/dir-watch-default.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/dir-watch-dnotify.c b/bus/dir-watch-dnotify.c index 0f6390cd..b38d7d19 100644 --- a/bus/dir-watch-dnotify.c +++ b/bus/dir-watch-dnotify.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/dir-watch-inotify.c b/bus/dir-watch-inotify.c index 12fdbb07..ee580d74 100644 --- a/bus/dir-watch-inotify.c +++ b/bus/dir-watch-inotify.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -97,7 +97,11 @@ bus_watch_directory (const char *dir, BusContext *context) _dbus_assert (dir != NULL); if (inotify_fd == -1) { +#ifdef HAVE_INOTIFY_INIT1 + inotify_fd = inotify_init1 (IN_CLOEXEC); +#else inotify_fd = inotify_init (); +#endif if (inotify_fd <= 0) { _dbus_warn ("Cannot initialize inotify\n"); goto out; diff --git a/bus/dir-watch-kqueue.c b/bus/dir-watch-kqueue.c index d491284d..16741dd0 100644 --- a/bus/dir-watch-kqueue.c +++ b/bus/dir-watch-kqueue.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/dir-watch.h b/bus/dir-watch.h index 171ade93..8e322a6e 100644 --- a/bus/dir-watch.h +++ b/bus/dir-watch.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/dispatch.c b/bus/dispatch.c index fa5874d2..a69a929c 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/dispatch.h b/bus/dispatch.h index 47144c92..fb5ba7a5 100644 --- a/bus/dispatch.h +++ b/bus/dispatch.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/driver.c b/bus/driver.c index b5138067..4a6a3243 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/driver.h b/bus/driver.h index 770b6d9f..713b2764 100644 --- a/bus/driver.h +++ b/bus/driver.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/expirelist.c b/bus/expirelist.c index d718d9ff..58e1f6d1 100644 --- a/bus/expirelist.c +++ b/bus/expirelist.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -157,7 +157,8 @@ do_expiration_with_current_time (BusExpireList *list, item->added_tv_usec, tv_sec, tv_usec); - if (elapsed >= (double) list->expire_after) + if (((item->added_tv_sec == 0) && (item->added_tv_usec == 0)) || + ((list->expire_after > 0) && (elapsed >= (double) list->expire_after))) { _dbus_verbose ("Expiring an item %p\n", item); @@ -173,7 +174,7 @@ do_expiration_with_current_time (BusExpireList *list, break; } } - else + else if (list->expire_after > 0) { double to_wait; diff --git a/bus/expirelist.h b/bus/expirelist.h index af0a0729..887cb97b 100644 --- a/bus/expirelist.h +++ b/bus/expirelist.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "bus.h" diff --git a/bus/policy.c b/bus/policy.c index ef31800f..bc1d2d9d 100644 --- a/bus/policy.c +++ b/bus/policy.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/policy.h b/bus/policy.h index a75e0dd9..1782dbf3 100644 --- a/bus/policy.h +++ b/bus/policy.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/selinux.c b/bus/selinux.c index 46a18a93..df9a00b1 100644 --- a/bus/selinux.c +++ b/bus/selinux.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include <dbus/dbus-internals.h> diff --git a/bus/selinux.h b/bus/selinux.h index 462a79b4..3bab36de 100644 --- a/bus/selinux.h +++ b/bus/selinux.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/services.c b/bus/services.c index 94715bfd..b260c633 100644 --- a/bus/services.c +++ b/bus/services.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include <dbus/dbus-hash.h> diff --git a/bus/services.h b/bus/services.h index 3ecd6d20..056dd9fa 100644 --- a/bus/services.h +++ b/bus/services.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/session.conf.in b/bus/session.conf.in index aed320eb..85395c52 100644 --- a/bus/session.conf.in +++ b/bus/session.conf.in @@ -59,6 +59,5 @@ <limit name="max_names_per_connection">50000</limit> <limit name="max_match_rules_per_connection">50000</limit> <limit name="max_replies_per_connection">50000</limit> - <limit name="reply_timeout">300000</limit> </busconfig> diff --git a/bus/signals.c b/bus/signals.c index c90149b2..b020a76c 100644 --- a/bus/signals.c +++ b/bus/signals.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "signals.h" diff --git a/bus/signals.h b/bus/signals.h index ab3c33aa..4ea10755 100644 --- a/bus/signals.h +++ b/bus/signals.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/test-launch-helper.c b/bus/test-launch-helper.c index e7ac18b9..d78ca519 100644 --- a/bus/test-launch-helper.c +++ b/bus/test-launch-helper.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/test-main.c b/bus/test-main.c index 2583f9a8..000bdd5a 100644 --- a/bus/test-main.c +++ b/bus/test-main.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/test-system.c b/bus/test-system.c index 2ecca7e7..6224ab5e 100644 --- a/bus/test-system.c +++ b/bus/test-system.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/utils.c b/bus/utils.c index 8e9353e4..7d248727 100644 --- a/bus/utils.c +++ b/bus/utils.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/bus/utils.h b/bus/utils.h index 1d8bdb29..f533895f 100644 --- a/bus/utils.h +++ b/bus/utils.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/cmake/dbus/dbus-arch-deps.h.cmake b/cmake/dbus/dbus-arch-deps.h.cmake index 0389da1e..7d566e9f 100644 --- a/cmake/dbus/dbus-arch-deps.h.cmake +++ b/cmake/dbus/dbus-arch-deps.h.cmake @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/configure.in b/configure.in index 2a0e64e2..c011b4a7 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_PREREQ(2.52) m4_define([dbus_major_version], [1]) m4_define([dbus_minor_version], [2]) -m4_define([dbus_micro_version], [14]) +m4_define([dbus_micro_version], [16]) m4_define([dbus_version], [dbus_major_version.dbus_minor_version.dbus_micro_version]) AC_INIT(dbus, [dbus_version]) @@ -130,249 +130,6 @@ if test x$enable_userdb_cache = xyes; then AC_DEFINE(DBUS_ENABLE_USERDB_CACHE,1,[Build with caching of user data]) fi -#### gcc warning flags - -cc_supports_flag() { - AC_MSG_CHECKING(whether $CC supports "$@") - Cfile=/tmp/foo${$} - touch ${Cfile}.c - $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1 - rc=$? - rm -f ${Cfile}.c ${Cfile}.o - case $rc in - 0) AC_MSG_RESULT(yes);; - *) AC_MSG_RESULT(no);; - esac - return $rc -} - -ld_supports_flag() { - AC_MSG_CHECKING([whether $LD supports "$@"]) - AC_TRY_LINK([ - int one(void) { return 1; } - int two(void) { return 2; } - ], [ two(); ] , [_ac_ld_flag_supported=yes], [_ac_ld_flag_supported=no]) - - if test "$_ac_ld_flag_supported" = "yes"; then - rm -f conftest.c - touch conftest.c - if $CC -c conftest.c; then - ld_out=`$LD $@ -o conftest conftest.o 2>&1` - ld_ret=$? - if test $ld_ret -ne 0 ; then - _ac_ld_flag_supported=no - elif echo "$ld_out" | egrep 'option ignored|^usage:|unrecognized option|illegal option' >/dev/null ; then - _ac_ld_flag_supported=no - fi - fi - rm -f conftest.c conftest.o conftest - fi - - AC_MSG_RESULT($_ac_ld_flag_supported) - if test "$_ac_ld_flag_supported" = "yes" ; then - return 0 - else - return 1 - fi -} - -if test x$USE_MAINTAINER_MODE = xyes; then - if cc_supports_flag "-Werror"; then - CFLAGS="$CFLAGS -Werror" - fi -fi - -if test "x$GCC" = "xyes"; then - changequote(,)dnl - case " $CFLAGS " in - *[\ \ ]-Wall[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wall" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wchar-subscripts[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wchar-subscripts" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wmissing-declarations[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wmissing-declarations" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wnested-externs[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wnested-externs" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wpointer-arith[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wpointer-arith" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wcast-align[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wcast-align" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wfloat-equal[\ \ ]*) ;; - *) if cc_supports_flag -Wfloat-equals; then - CFLAGS="$CFLAGS -Wfloat-equal" - fi - ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wdeclaration-after-statement[\ \ ]*) ;; - *) if cc_supports_flag -Wdeclaration-after-statement; then - CFLAGS="$CFLAGS -Wdeclaration-after-statement" - fi - ;; - esac - - case " $CFLAGS " in - *[\ \ ]-fno-common[\ \ ]*) ;; - *) if cc_supports_flag -fno-common; then - CFLAGS="$CFLAGS -fno-common" - fi - ;; - esac - - case " $CFLAGS " in - *[\ \ ]-fPIC[\ \ ]*) ;; - *) if cc_supports_flag -fPIC; then - PIC_CFLAGS="-fPIC" - if ld_supports_flag -z,relro; then - PIC_LDFLAGS="-Wl,-z,relro" - fi - fi - ;; - esac - - case " $CFLAGS " in - *[\ \ ]-fPIE[\ \ ]*) ;; - *) if cc_supports_flag -fPIE; then - PIE_CFLAGS="-fPIE" - if ld_supports_flag -z,relro; then - PIE_LDFLAGS="-pie -Wl,-z,relro" - else - PIE_LDFLAGS="-pie" - fi - fi - ;; - esac - - ### Disabled warnings, and compiler flag overrides - - # Let's just ignore unused for now - case " $CFLAGS " in - *[\ \ ]-Wno-unused[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wno-unused" ;; - esac - - # This group is for warnings we currently don't pass. - # We would like to, however. Please fix. - - # http://bugs.freedesktop.org/show_bug.cgi?id=17433 - case " $CFLAGS " in - *[\ \ ]-Wno-sign-compare[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wno-sign-compare" ;; - esac - case " $CFLAGS " in - *[\ \ ]-Wno-pointer-sign[\ \ ]*) ;; - *) if cc_supports_flag -Wno-pointer-sign; then - CFLAGS="$CFLAGS -Wno-pointer-sign" - fi - ;; - esac - - # http://bugs.freedesktop.org/show_bug.cgi?id=19195 - case " $CFLAGS " in - *[\ \ ]-Wno-format[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wno-format" ;; - esac - - # This one is special - it's not a warning override. - # http://bugs.freedesktop.org/show_bug.cgi?id=10599 - case " $CFLAGS " in - *[\ \ ]-fno-strict-aliasing[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -fno-strict-aliasing" ;; - esac - ### End disabled warnings - - if test "x$enable_ansi" = "xyes"; then - case " $CFLAGS " in - *[\ \ ]-ansi[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -ansi" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-D_POSIX_C_SOURCE*) ;; - *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-pedantic[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -pedantic" ;; - esac - fi - if test x$enable_gcov = xyes; then - case " $CFLAGS " in - *[\ \ ]-fprofile-arcs[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -fprofile-arcs" ;; - esac - case " $CFLAGS " in - *[\ \ ]-ftest-coverage[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -ftest-coverage" ;; - esac - - ## remove optimization - CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'` - fi - changequote([,])dnl -else - if test x$enable_gcov = xyes; then - AC_MSG_ERROR([--enable-gcov can only be used with gcc]) - fi -fi - -AC_SUBST(PIC_CFLAGS) -AC_SUBST(PIC_LDFLAGS) -AC_SUBST(PIE_CFLAGS) -AC_SUBST(PIE_LDFLAGS) - -if ld_supports_flag --gc-sections; then - SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" - CFLAGS="-ffunction-sections -fdata-sections $CFLAGS" -fi -AC_SUBST(SECTION_FLAGS) -AC_SUBST(SECTION_LDFLAGS) -AC_MSG_RESULT($ac_gcsections) - -# Add -D_POSIX_PTHREAD_SEMANTICS if on Solaris -# -case $host_os in - solaris*) - CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS" ;; -esac - -changequote(,)dnl -# compress spaces in flags -CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'` -CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ +/ /g'` -CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ +/ /g'` -changequote([,])dnl - if test x$enable_gcov = xyes; then ## so that config.h changes when you toggle gcov support AC_DEFINE_UNQUOTED(DBUS_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing]) @@ -514,7 +271,8 @@ dnl we currently check for all three va_copy possibilities, so we get dnl all results in config.log for bug reports. AC_CACHE_CHECK([for an implementation of va_copy()],dbus_cv_va_copy,[ AC_LINK_IFELSE([#include <stdarg.h> - void f (int i, ...) { +#include <stdlib.h> + static void f (int i, ...) { va_list args1, args2; va_start (args1, i); va_copy (args2, args1); @@ -531,7 +289,8 @@ AC_CACHE_CHECK([for an implementation of va_copy()],dbus_cv_va_copy,[ ]) AC_CACHE_CHECK([for an implementation of __va_copy()],dbus_cv___va_copy,[ AC_LINK_IFELSE([#include <stdarg.h> - void f (int i, ...) { +#include <stdlib.h> + static void f (int i, ...) { va_list args1, args2; va_start (args1, i); __va_copy (args2, args1); @@ -564,9 +323,10 @@ AC_CACHE_CHECK([whether va_lists can be copied by value], [AC_RUN_IFELSE([AC_LANG_PROGRAM( [[ #include <stdarg.h> + #include <stdlib.h> ]], [[ - void f (int i, ...) { + static void f (int i, ...) { va_list args1, args2; va_start (args1, i); args2 = args1; @@ -609,7 +369,7 @@ fi AC_DEFINE_UNQUOTED([DBUS_USE_SYNC], [$have_sync], [Use the gcc __sync extension]) #### Various functions -AC_CHECK_LIB(socket,socket) +AC_SEARCH_LIBS(socket,[socket network]) AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)]) AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll) @@ -683,6 +443,13 @@ AC_CHECK_HEADERS(byteswap.h) AC_CHECK_HEADERS(unistd.h) +# Add -D_POSIX_PTHREAD_SEMANTICS if on Solaris +# +case $host_os in + solaris*) + CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS" ;; +esac + # checking for a posix version of getpwnam_r # if we are cross compiling and can not run the test # assume getpwnam_r is the posix version @@ -926,8 +693,31 @@ if $dbus_use_libxml; then fi # Thread lib detection -AC_CHECK_FUNC(pthread_cond_timedwait,,[AC_CHECK_LIB(pthread,pthread_cond_timedwait, +AC_CHECK_FUNC(pthread_cond_timedwait,[AC_CHECK_LIB(pthread,pthread_cond_timedwait, [THREAD_LIBS="-lpthread"])]) +save_libs="$LIBS" +LIBS="$LIBS $THREAD_LIBS" +AC_CHECK_FUNC(pthread_condattr_setclock,have_pthread_condattr_setclock=true,have_pthread_condattr_setclock=false) +if test x$have_pthread_condattr_setclock = xtrue; then + AC_SEARCH_LIBS([clock_getres],[rt],[THREAD_LIBS="$THREAD_LIBS -lrt"]) + AC_MSG_CHECKING([for CLOCK_MONOTONIC]) + AC_TRY_COMPILE([#include <time.h> +#include <pthread.h> +], [ +struct timespec monotonic_timer; +pthread_condattr_t attr; +pthread_condattr_init (&attr); +pthread_condattr_setclock (&attr, CLOCK_MONOTONIC); +clock_getres (CLOCK_MONOTONIC,&monotonic_timer); +], have_clock_monotonic=true, have_clock_monotonic=false) +if test x$have_clock_monotonic = xtrue; then + AC_MSG_RESULT([found]) + AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1, [Define if we have CLOCK_MONOTONIC]) +else + AC_MSG_RESULT([not found]) +fi +fi +LIBS="$save_libs" # SELinux detection if test x$enable_selinux = xno ; then @@ -984,7 +774,7 @@ fi dnl check if inotify backend is enabled if test x$have_inotify = xyes; then AC_DEFINE(DBUS_BUS_ENABLE_INOTIFY,1,[Use inotify]) - + AC_CHECK_FUNCS(inotify_init1) fi AM_CONDITIONAL(DBUS_BUS_ENABLE_INOTIFY, test x$have_inotify = xyes) @@ -1138,6 +928,250 @@ fi AC_SUBST(DBUS_X_CFLAGS) AC_SUBST(DBUS_X_LIBS) + +#### gcc warning flags + +cc_supports_flag() { + AC_MSG_CHECKING(whether $CC supports "$@") + Cfile=/tmp/foo${$} + touch ${Cfile}.c + $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1 + rc=$? + rm -f ${Cfile}.c ${Cfile}.o + case $rc in + 0) AC_MSG_RESULT(yes);; + *) AC_MSG_RESULT(no);; + esac + return $rc +} + +ld_supports_flag() { + AC_MSG_CHECKING([whether $LD supports "$@"]) + AC_TRY_LINK([ + int one(void) { return 1; } + int two(void) { return 2; } + ], [ two(); ] , [_ac_ld_flag_supported=yes], [_ac_ld_flag_supported=no]) + + if test "$_ac_ld_flag_supported" = "yes"; then + rm -f conftest.c + touch conftest.c + if $CC -c conftest.c; then + ld_out=`$LD $@ -o conftest conftest.o 2>&1` + ld_ret=$? + if test $ld_ret -ne 0 ; then + _ac_ld_flag_supported=no + elif echo "$ld_out" | egrep 'option ignored|^usage:|unrecognized option|illegal option' >/dev/null ; then + _ac_ld_flag_supported=no + fi + fi + rm -f conftest.c conftest.o conftest + fi + + AC_MSG_RESULT($_ac_ld_flag_supported) + if test "$_ac_ld_flag_supported" = "yes" ; then + return 0 + else + return 1 + fi +} + +if test x$USE_MAINTAINER_MODE = xyes; then + if cc_supports_flag "-Werror"; then + CFLAGS="$CFLAGS -Werror" + fi +fi + +if test "x$GCC" = "xyes"; then + changequote(,)dnl + case " $CFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wall" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wchar-subscripts[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wchar-subscripts" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wmissing-declarations[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wmissing-declarations" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wnested-externs[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wnested-externs" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wpointer-arith[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wpointer-arith" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wcast-align[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wcast-align" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wfloat-equal[\ \ ]*) ;; + *) if cc_supports_flag -Wfloat-equals; then + CFLAGS="$CFLAGS -Wfloat-equal" + fi + ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wdeclaration-after-statement[\ \ ]*) ;; + *) if cc_supports_flag -Wdeclaration-after-statement; then + CFLAGS="$CFLAGS -Wdeclaration-after-statement" + fi + ;; + esac + + case " $CFLAGS " in + *[\ \ ]-fno-common[\ \ ]*) ;; + *) if cc_supports_flag -fno-common; then + CFLAGS="$CFLAGS -fno-common" + fi + ;; + esac + + case " $CFLAGS " in + *[\ \ ]-fPIC[\ \ ]*) ;; + *) if cc_supports_flag -fPIC; then + PIC_CFLAGS="-fPIC" + if ld_supports_flag -z,relro; then + PIC_LDFLAGS="-Wl,-z,relro" + fi + fi + ;; + esac + + case " $CFLAGS " in + *[\ \ ]-fPIE[\ \ ]*) ;; + *) if cc_supports_flag -fPIE; then + PIE_CFLAGS="-fPIE" + if ld_supports_flag -z,relro; then + PIE_LDFLAGS="-pie -Wl,-z,relro" + else + PIE_LDFLAGS="-pie" + fi + fi + ;; + esac + + ### Disabled warnings, and compiler flag overrides + + # Let's just ignore unused for now + case " $CFLAGS " in + *[\ \ ]-Wno-unused[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wno-unused" ;; + esac + + # This group is for warnings we currently don't pass. + # We would like to, however. Please fix. + + # http://bugs.freedesktop.org/show_bug.cgi?id=17433 + case " $CFLAGS " in + *[\ \ ]-Wno-sign-compare[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wno-sign-compare" ;; + esac + case " $CFLAGS " in + *[\ \ ]-Wno-pointer-sign[\ \ ]*) ;; + *) if cc_supports_flag -Wno-pointer-sign; then + CFLAGS="$CFLAGS -Wno-pointer-sign" + fi + ;; + esac + + # http://bugs.freedesktop.org/show_bug.cgi?id=19195 + case " $CFLAGS " in + *[\ \ ]-Wno-format[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wno-format" ;; + esac + + # This one is special - it's not a warning override. + # http://bugs.freedesktop.org/show_bug.cgi?id=10599 + case " $CFLAGS " in + *[\ \ ]-fno-strict-aliasing[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -fno-strict-aliasing" ;; + esac + ### End disabled warnings + + if test "x$enable_ansi" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -ansi" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-D_POSIX_C_SOURCE*) ;; + *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -pedantic" ;; + esac + fi + if test x$enable_gcov = xyes; then + case " $CFLAGS " in + *[\ \ ]-fprofile-arcs[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -fprofile-arcs" ;; + esac + case " $CFLAGS " in + *[\ \ ]-ftest-coverage[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -ftest-coverage" ;; + esac + + ## remove optimization + CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'` + fi + changequote([,])dnl +else + if test x$enable_gcov = xyes; then + AC_MSG_ERROR([--enable-gcov can only be used with gcc]) + fi +fi + +AC_SUBST(PIC_CFLAGS) +AC_SUBST(PIC_LDFLAGS) +AC_SUBST(PIE_CFLAGS) +AC_SUBST(PIE_LDFLAGS) + +if ld_supports_flag --gc-sections; then + SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" + CFLAGS="-ffunction-sections -fdata-sections $CFLAGS" +fi +AC_SUBST(SECTION_FLAGS) +AC_SUBST(SECTION_LDFLAGS) +AC_MSG_RESULT($ac_gcsections) + +# Add -D_POSIX_PTHREAD_SEMANTICS if on Solaris +# +case $host_os in + solaris*) + CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS" ;; +esac + +changequote(,)dnl +# compress spaces in flags +CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'` +CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ +/ /g'` +CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ +/ /g'` +changequote([,])dnl + ### Doxygen Documentation AC_PATH_PROG(DOXYGEN, doxygen, no) diff --git a/dbus/dbus-address.c b/dbus/dbus-address.c index 28e88424..90484dc1 100644 --- a/dbus/dbus-address.c +++ b/dbus/dbus-address.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-address.h b/dbus/dbus-address.h index c569044a..07d5339c 100644 --- a/dbus/dbus-address.h +++ b/dbus/dbus-address.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/dbus/dbus-arch-deps.h.in b/dbus/dbus-arch-deps.h.in index ca8e286b..45952cfb 100644 --- a/dbus/dbus-arch-deps.h.in +++ b/dbus/dbus-arch-deps.h.in @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/dbus/dbus-auth-script.c b/dbus/dbus-auth-script.c index 93d6f78c..6285e3ba 100644 --- a/dbus/dbus-auth-script.c +++ b/dbus/dbus-auth-script.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include <config.h> diff --git a/dbus/dbus-auth-script.h b/dbus/dbus-auth-script.h index 1f4da1b5..30cd5642 100644 --- a/dbus/dbus-auth-script.h +++ b/dbus/dbus-auth-script.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-auth-util.c b/dbus/dbus-auth-util.c index e5019042..09ecdd47 100644 --- a/dbus/dbus-auth-util.c +++ b/dbus/dbus-auth-util.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-internals.h" diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c index f1c83ae4..1b4792de 100644 --- a/dbus/dbus-auth.c +++ b/dbus/dbus-auth.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-auth.h" diff --git a/dbus/dbus-auth.h b/dbus/dbus-auth.h index 5680df11..ae3f3647 100644 --- a/dbus/dbus-auth.h +++ b/dbus/dbus-auth.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_AUTH_H diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c index f97cce68..92ec20ed 100644 --- a/dbus/dbus-bus.c +++ b/dbus/dbus-bus.c @@ -18,10 +18,11 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ +#include <config.h> #include "dbus-bus.h" #include "dbus-protocol.h" #include "dbus-internals.h" @@ -29,7 +30,7 @@ #include "dbus-marshal-validate.h" #include "dbus-threads-internal.h" #include "dbus-connection-internal.h" -#include <string.h> +#include "dbus-string.h" /** * @defgroup DBusBus Message bus APIs @@ -147,6 +148,63 @@ get_from_env (char **connection_p, } static dbus_bool_t +init_session_address (void) +{ + dbus_bool_t retval; + + retval = FALSE; + + /* First, look in the environment. This is the normal case on + * freedesktop.org/Unix systems. */ + get_from_env (&bus_connection_addresses[DBUS_BUS_SESSION], + "DBUS_SESSION_BUS_ADDRESS"); + if (bus_connection_addresses[DBUS_BUS_SESSION] == NULL) + { + dbus_bool_t supported; + DBusString addr; + DBusError error = DBUS_ERROR_INIT; + + if (!_dbus_string_init (&addr)) + return FALSE; + + supported = FALSE; + /* So it's not in the environment - let's try a platform-specific method. + * On MacOS, this involves asking launchd. On Windows (not specified yet) + * we might do a COM lookup. + * Ignore errors - if we failed, fall back to autolaunch. */ + retval = _dbus_lookup_session_address (&supported, &addr, &error); + if (supported && retval) + { + retval =_dbus_string_steal_data (&addr, &bus_connection_addresses[DBUS_BUS_SESSION]); + } + else if (supported && !retval) + { + if (dbus_error_is_set(&error)) + _dbus_warn ("Dynamic session lookup supported but failed: %s\n", error.message); + else + _dbus_warn ("Dynamic session lookup supported but failed silently\n"); + } + _dbus_string_free (&addr); + } + else + retval = TRUE; + + if (!retval) + return FALSE; + + /* The DBUS_SESSION_BUS_DEFAULT_ADDRESS should have really been named + * DBUS_SESSION_BUS_FALLBACK_ADDRESS. + */ + if (bus_connection_addresses[DBUS_BUS_SESSION] == NULL) + bus_connection_addresses[DBUS_BUS_SESSION] = + _dbus_strdup (DBUS_SESSION_BUS_DEFAULT_ADDRESS); + if (bus_connection_addresses[DBUS_BUS_SESSION] == NULL) + return FALSE; + + return TRUE; +} + +static dbus_bool_t init_connections_unlocked (void) { if (!initialized) @@ -198,17 +256,9 @@ init_connections_unlocked (void) { _dbus_verbose ("Filling in session bus address...\n"); - if (!get_from_env (&bus_connection_addresses[DBUS_BUS_SESSION], - "DBUS_SESSION_BUS_ADDRESS")) + if (!init_session_address ()) return FALSE; - if (bus_connection_addresses[DBUS_BUS_SESSION] == NULL) - bus_connection_addresses[DBUS_BUS_SESSION] = - _dbus_strdup (DBUS_SESSION_BUS_DEFAULT_ADDRESS); - - if (bus_connection_addresses[DBUS_BUS_SESSION] == NULL) - return FALSE; - _dbus_verbose (" \"%s\"\n", bus_connection_addresses[DBUS_BUS_SESSION] ? bus_connection_addresses[DBUS_BUS_SESSION] : "none set"); } diff --git a/dbus/dbus-bus.h b/dbus/dbus-bus.h index 7d4f1338..e36449c7 100644 --- a/dbus/dbus-bus.h +++ b/dbus/dbus-bus.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/dbus/dbus-connection-internal.h b/dbus/dbus-connection-internal.h index df54412b..721b5d73 100644 --- a/dbus/dbus-connection-internal.h +++ b/dbus/dbus-connection-internal.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_CONNECTION_INTERNAL_H diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index e46fbc3d..a59b1a0c 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -889,21 +889,34 @@ _dbus_connection_attach_pending_call_unlocked (DBusConnection *connection, timeout = _dbus_pending_call_get_timeout_unlocked (pending); - if (!_dbus_connection_add_timeout_unlocked (connection, timeout)) - return FALSE; - - if (!_dbus_hash_table_insert_int (connection->pending_replies, - reply_serial, - pending)) + if (timeout) { - _dbus_connection_remove_timeout_unlocked (connection, timeout); + if (!_dbus_connection_add_timeout_unlocked (connection, timeout)) + return FALSE; + + if (!_dbus_hash_table_insert_int (connection->pending_replies, + reply_serial, + pending)) + { + _dbus_connection_remove_timeout_unlocked (connection, timeout); - _dbus_pending_call_set_timeout_added_unlocked (pending, FALSE); - HAVE_LOCK_CHECK (connection); - return FALSE; + _dbus_pending_call_set_timeout_added_unlocked (pending, FALSE); + HAVE_LOCK_CHECK (connection); + return FALSE; + } + + _dbus_pending_call_set_timeout_added_unlocked (pending, TRUE); + } + else + { + if (!_dbus_hash_table_insert_int (connection->pending_replies, + reply_serial, + pending)) + { + HAVE_LOCK_CHECK (connection); + return FALSE; + } } - - _dbus_pending_call_set_timeout_added_unlocked (pending, TRUE); _dbus_pending_call_ref_unlocked (pending); @@ -2194,8 +2207,10 @@ connection_timeout_and_complete_all_pending_calls_unlocked (DBusConnection *conn _dbus_pending_call_queue_timeout_error_unlocked (pending, connection); - _dbus_connection_remove_timeout_unlocked (connection, - _dbus_pending_call_get_timeout_unlocked (pending)); + + if (_dbus_pending_call_is_timeout_added_unlocked (pending)) + _dbus_connection_remove_timeout_unlocked (connection, + _dbus_pending_call_get_timeout_unlocked (pending)); _dbus_pending_call_set_timeout_added_unlocked (pending, FALSE); _dbus_hash_iter_remove_entry (&iter); @@ -2266,12 +2281,12 @@ void _dbus_connection_block_pending_call (DBusPendingCall *pending) { long start_tv_sec, start_tv_usec; - long end_tv_sec, end_tv_usec; long tv_sec, tv_usec; DBusDispatchStatus status; DBusConnection *connection; dbus_uint32_t client_serial; - int timeout_milliseconds; + DBusTimeout *timeout; + int timeout_milliseconds, elapsed_milliseconds; _dbus_assert (pending != NULL); @@ -2291,19 +2306,23 @@ _dbus_connection_block_pending_call (DBusPendingCall *pending) * in _dbus_pending_call_new() so overflows aren't possible * below */ - timeout_milliseconds = dbus_timeout_get_interval (_dbus_pending_call_get_timeout_unlocked (pending)); - - _dbus_get_current_time (&start_tv_sec, &start_tv_usec); - end_tv_sec = start_tv_sec + timeout_milliseconds / 1000; - end_tv_usec = start_tv_usec + (timeout_milliseconds % 1000) * 1000; - end_tv_sec += end_tv_usec / _DBUS_USEC_PER_SECOND; - end_tv_usec = end_tv_usec % _DBUS_USEC_PER_SECOND; + timeout = _dbus_pending_call_get_timeout_unlocked (pending); + if (timeout) + { + timeout_milliseconds = dbus_timeout_get_interval (timeout); + _dbus_get_current_time (&start_tv_sec, &start_tv_usec); + + _dbus_verbose ("dbus_connection_send_with_reply_and_block(): will block %d milliseconds for reply serial %u from %ld sec %ld usec\n", + timeout_milliseconds, + client_serial, + start_tv_sec, start_tv_usec); + } + else + { + timeout_milliseconds = -1; - _dbus_verbose ("dbus_connection_send_with_reply_and_block(): will block %d milliseconds for reply serial %u from %ld sec %ld usec to %ld sec %ld usec\n", - timeout_milliseconds, - client_serial, - start_tv_sec, start_tv_usec, - end_tv_sec, end_tv_usec); + _dbus_verbose ("dbus_connection_send_with_reply_and_block(): will block for reply serial %u\n", client_serial); + } /* check to see if we already got the data off the socket */ /* from another blocked pending call */ @@ -2345,6 +2364,8 @@ _dbus_connection_block_pending_call (DBusPendingCall *pending) } _dbus_get_current_time (&tv_sec, &tv_usec); + elapsed_milliseconds = (tv_sec - start_tv_sec) * 1000 + + (tv_usec - start_tv_usec) / 1000; if (!_dbus_connection_get_is_connected_unlocked (connection)) { @@ -2359,15 +2380,36 @@ _dbus_connection_block_pending_call (DBusPendingCall *pending) dbus_pending_call_unref (pending); return; } - else if (tv_sec < start_tv_sec) - _dbus_verbose ("dbus_connection_send_with_reply_and_block(): clock set backward\n"); else if (connection->disconnect_message_link == NULL) _dbus_verbose ("dbus_connection_send_with_reply_and_block(): disconnected\n"); - else if (tv_sec < end_tv_sec || - (tv_sec == end_tv_sec && tv_usec < end_tv_usec)) + else if (timeout == NULL) + { + if (status == DBUS_DISPATCH_NEED_MEMORY) + { + /* Try sleeping a bit, as we aren't sure we need to block for reading, + * we may already have a reply in the buffer and just can't process + * it. + */ + _dbus_verbose ("dbus_connection_send_with_reply_and_block() waiting for more memory\n"); + + _dbus_memory_pause_based_on_timeout (timeout_milliseconds); + } + else + { + /* block again, we don't have the reply buffered yet. */ + _dbus_connection_do_iteration_unlocked (connection, + DBUS_ITERATION_DO_READING | + DBUS_ITERATION_BLOCK, + timeout_milliseconds); + } + + goto recheck_status; + } + else if (tv_sec < start_tv_sec) + _dbus_verbose ("dbus_connection_send_with_reply_and_block(): clock set backward\n"); + else if (elapsed_milliseconds < timeout_milliseconds) { - timeout_milliseconds = (end_tv_sec - tv_sec) * 1000 + - (end_tv_usec - tv_usec) / 1000; + timeout_milliseconds -= elapsed_milliseconds; _dbus_verbose ("dbus_connection_send_with_reply_and_block(): %d milliseconds remain\n", timeout_milliseconds); _dbus_assert (timeout_milliseconds >= 0); @@ -3231,10 +3273,8 @@ reply_handler_timeout (void *data) * * If -1 is passed for the timeout, a sane default timeout is used. -1 * is typically the best value for the timeout for this reason, unless - * you want a very short or very long timeout. There is no way to - * avoid a timeout entirely, other than passing INT_MAX for the - * timeout to mean "very long timeout." libdbus clamps an INT_MAX - * timeout down to a few hours timeout though. + * you want a very short or very long timeout. If INT_MAX is passed for + * the timeout, no timeout will be set and the call will block forever. * * @warning if the connection is disconnected or you try to send Unix * file descriptors on a connection that does not support them, the @@ -3246,7 +3286,7 @@ reply_handler_timeout (void *data) * object, or #NULL if connection is disconnected or when you try to * send Unix file descriptors on a connection that does not support * them. - * @param timeout_milliseconds timeout in milliseconds or -1 for default + * @param timeout_milliseconds timeout in milliseconds, -1 for default or INT_MAX for no timeout * @returns #FALSE if no memory, #TRUE otherwise. * */ @@ -3379,7 +3419,7 @@ dbus_connection_send_with_reply (DBusConnection *connection, * * @param connection the connection * @param message the message to send - * @param timeout_milliseconds timeout in milliseconds or -1 for default + * @param timeout_milliseconds timeout in milliseconds, -1 for default or INT_MAX for no timeout. * @param error return location for error message * @returns the message that is the reply or #NULL with an error code if the * function fails. @@ -5440,6 +5480,7 @@ dbus_connection_remove_filter (DBusConnection *connection, } link = _dbus_list_get_prev_link (&connection->filter_list, link); + filter = NULL; } CONNECTION_UNLOCK (connection); diff --git a/dbus/dbus-connection.h b/dbus/dbus-connection.h index 3facc873..ede3dcd1 100644 --- a/dbus/dbus-connection.h +++ b/dbus/dbus-connection.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/dbus/dbus-credentials-util.c b/dbus/dbus-credentials-util.c index 74305973..dae6080d 100644 --- a/dbus/dbus-credentials-util.c +++ b/dbus/dbus-credentials-util.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-internals.h" diff --git a/dbus/dbus-credentials.c b/dbus/dbus-credentials.c index f21ecb27..f06d5c00 100644 --- a/dbus/dbus-credentials.c +++ b/dbus/dbus-credentials.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include <config.h> diff --git a/dbus/dbus-credentials.h b/dbus/dbus-credentials.h index 8eed2bd2..25f31b79 100644 --- a/dbus/dbus-credentials.h +++ b/dbus/dbus-credentials.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_CREDENTIALS_H diff --git a/dbus/dbus-dataslot.c b/dbus/dbus-dataslot.c index a7ad2e45..8fab7bbc 100644 --- a/dbus/dbus-dataslot.c +++ b/dbus/dbus-dataslot.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-dataslot.h" diff --git a/dbus/dbus-dataslot.h b/dbus/dbus-dataslot.h index e3c2099a..2e706f72 100644 --- a/dbus/dbus-dataslot.h +++ b/dbus/dbus-dataslot.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_DATASLOT_H diff --git a/dbus/dbus-errors.c b/dbus/dbus-errors.c index 6d14ff7a..5d7299f9 100644 --- a/dbus/dbus-errors.c +++ b/dbus/dbus-errors.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-errors.h" diff --git a/dbus/dbus-errors.h b/dbus/dbus-errors.h index 0a480d8c..0ddf2477 100644 --- a/dbus/dbus-errors.h +++ b/dbus/dbus-errors.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/dbus/dbus-hash.c b/dbus/dbus-hash.c index d0778bf4..e9eba6e5 100644 --- a/dbus/dbus-hash.c +++ b/dbus/dbus-hash.c @@ -24,7 +24,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* diff --git a/dbus/dbus-hash.h b/dbus/dbus-hash.h index 661e86de..78f69ddf 100644 --- a/dbus/dbus-hash.h +++ b/dbus/dbus-hash.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index f3ca7c55..c5885eae 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-internals.h" diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index 835fe46a..faa24294 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef DBUS_INSIDE_DBUS_H diff --git a/dbus/dbus-keyring.c b/dbus/dbus-keyring.c index 8cc4048f..6dc1e129 100644 --- a/dbus/dbus-keyring.c +++ b/dbus/dbus-keyring.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-keyring.h b/dbus/dbus-keyring.h index ed7b3cbe..200e31bc 100644 --- a/dbus/dbus-keyring.h +++ b/dbus/dbus-keyring.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_KEYRING_H diff --git a/dbus/dbus-list.c b/dbus/dbus-list.c index d314e958..e075ffe1 100644 --- a/dbus/dbus-list.c +++ b/dbus/dbus-list.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-list.h b/dbus/dbus-list.h index 69ce265c..663ad257 100644 --- a/dbus/dbus-list.h +++ b/dbus/dbus-list.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-macros.h b/dbus/dbus-macros.h index bf004b8b..497dd450 100644 --- a/dbus/dbus-macros.h +++ b/dbus/dbus-macros.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/dbus/dbus-mainloop.c b/dbus/dbus-mainloop.c index ab595af4..a3833588 100644 --- a/dbus/dbus-mainloop.c +++ b/dbus/dbus-mainloop.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-mainloop.h b/dbus/dbus-mainloop.h index 4a3f9ec4..656f8231 100644 --- a/dbus/dbus-mainloop.h +++ b/dbus/dbus-mainloop.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-marshal-basic.c b/dbus/dbus-marshal-basic.c index d396b6db..00551354 100644 --- a/dbus/dbus-marshal-basic.c +++ b/dbus/dbus-marshal-basic.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-marshal-basic.h b/dbus/dbus-marshal-basic.h index f09c5208..fd87a80f 100644 --- a/dbus/dbus-marshal-basic.h +++ b/dbus/dbus-marshal-basic.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-marshal-byteswap-util.c b/dbus/dbus-marshal-byteswap-util.c index 135852ee..edb74cad 100644 --- a/dbus/dbus-marshal-byteswap-util.c +++ b/dbus/dbus-marshal-byteswap-util.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-marshal-byteswap.c b/dbus/dbus-marshal-byteswap.c index 5f0945b9..c5e92b32 100644 --- a/dbus/dbus-marshal-byteswap.c +++ b/dbus/dbus-marshal-byteswap.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-marshal-byteswap.h b/dbus/dbus-marshal-byteswap.h index e0f90e3a..7c8ea7b6 100644 --- a/dbus/dbus-marshal-byteswap.h +++ b/dbus/dbus-marshal-byteswap.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-marshal-header.c b/dbus/dbus-marshal-header.c index 50b5f73c..d9e9bb51 100644 --- a/dbus/dbus-marshal-header.c +++ b/dbus/dbus-marshal-header.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-marshal-header.h b/dbus/dbus-marshal-header.h index e1cf52ee..0f36efac 100644 --- a/dbus/dbus-marshal-header.h +++ b/dbus/dbus-marshal-header.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-marshal-recursive-util.c b/dbus/dbus-marshal-recursive-util.c index c8ae93db..f87644c7 100644 --- a/dbus/dbus-marshal-recursive-util.c +++ b/dbus/dbus-marshal-recursive-util.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-marshal-recursive.c b/dbus/dbus-marshal-recursive.c index 76ee344f..ccf0d22b 100644 --- a/dbus/dbus-marshal-recursive.c +++ b/dbus/dbus-marshal-recursive.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-marshal-recursive.h b/dbus/dbus-marshal-recursive.h index e533227c..a743668d 100644 --- a/dbus/dbus-marshal-recursive.h +++ b/dbus/dbus-marshal-recursive.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-marshal-validate-util.c b/dbus/dbus-marshal-validate-util.c index ac901c38..81135bcf 100644 --- a/dbus/dbus-marshal-validate-util.c +++ b/dbus/dbus-marshal-validate-util.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-marshal-validate.c b/dbus/dbus-marshal-validate.c index fbfb1c31..bbaa9bdf 100644 --- a/dbus/dbus-marshal-validate.c +++ b/dbus/dbus-marshal-validate.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-marshal-validate.h b/dbus/dbus-marshal-validate.h index bf68ecd6..7a623d9e 100644 --- a/dbus/dbus-marshal-validate.h +++ b/dbus/dbus-marshal-validate.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-md5.h b/dbus/dbus-md5.h index 45018fa9..fdc74b33 100644 --- a/dbus/dbus-md5.h +++ b/dbus/dbus-md5.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_MD5_H diff --git a/dbus/dbus-memory.c b/dbus/dbus-memory.c index 8dc91471..5e93c047 100644 --- a/dbus/dbus-memory.c +++ b/dbus/dbus-memory.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-memory.h b/dbus/dbus-memory.h index 11b92252..aad439b8 100644 --- a/dbus/dbus-memory.h +++ b/dbus/dbus-memory.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/dbus/dbus-mempool.c b/dbus/dbus-mempool.c index f94134d0..2a41cb16 100644 --- a/dbus/dbus-mempool.c +++ b/dbus/dbus-mempool.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-mempool.h b/dbus/dbus-mempool.h index 459b45ef..afe52472 100644 --- a/dbus/dbus-mempool.h +++ b/dbus/dbus-mempool.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-message-factory.c b/dbus/dbus-message-factory.c index bd86dab9..7432cf27 100644 --- a/dbus/dbus-message-factory.c +++ b/dbus/dbus-message-factory.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include <config.h> diff --git a/dbus/dbus-message-factory.h b/dbus/dbus-message-factory.h index de5cc657..b0747504 100644 --- a/dbus/dbus-message-factory.h +++ b/dbus/dbus-message-factory.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-message-internal.h b/dbus/dbus-message-internal.h index 4302f091..5c616a12 100644 --- a/dbus/dbus-message-internal.h +++ b/dbus/dbus-message-internal.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_MESSAGE_INTERNAL_H diff --git a/dbus/dbus-message-private.h b/dbus/dbus-message-private.h index 03257a9b..366c53aa 100644 --- a/dbus/dbus-message-private.h +++ b/dbus/dbus-message-private.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_MESSAGE_PRIVATE_H diff --git a/dbus/dbus-message-util.c b/dbus/dbus-message-util.c index 1b139436..a56fcc49 100644 --- a/dbus/dbus-message-util.c +++ b/dbus/dbus-message-util.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -994,6 +994,7 @@ _dbus_message_test (const char *test_data_dir) unsigned char v_BYTE; unsigned char v2_BYTE; dbus_bool_t v_BOOLEAN; + DBusMessageIter iter, array_iter, struct_iter; #ifdef HAVE_UNIX_FD_PASSING int v_UNIX_FD; #endif @@ -1365,6 +1366,34 @@ _dbus_message_test (const char *test_data_dir) check_memleaks (); _dbus_check_fdleaks(); + /* Check that we can abandon a container */ + message = dbus_message_new_method_call ("org.freedesktop.DBus.TestService", + "/org/freedesktop/TestPath", + "Foo.TestInterface", + "Method"); + + dbus_message_iter_init_append (message, &iter); + + _dbus_assert (dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, + (DBUS_STRUCT_BEGIN_CHAR_AS_STRING + DBUS_TYPE_STRING_AS_STRING + DBUS_TYPE_STRING_AS_STRING + DBUS_STRUCT_END_CHAR_AS_STRING), + &array_iter)); + _dbus_assert (dbus_message_iter_open_container (&array_iter, DBUS_TYPE_STRUCT, + NULL, &struct_iter)); + + s = "peaches"; + _dbus_assert (dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_STRING, + &s)); + + /* uh-oh, error, try and unwind */ + + dbus_message_iter_abandon_container (&array_iter, &struct_iter); + dbus_message_iter_abandon_container (&array_iter, &iter); + + dbus_message_unref (message); + /* Load all the sample messages from the message factory */ { DBusMessageDataIter diter; diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index d8d746a6..33732292 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -1722,8 +1722,10 @@ dbus_message_append_args_valist (DBusMessage *message, if (!dbus_message_iter_append_fixed_array (&array, element_type, value, - n_elements)) + n_elements)) { + dbus_message_iter_abandon_container (&iter, &array); goto failed; + } } else if (element_type == DBUS_TYPE_STRING || element_type == DBUS_TYPE_SIGNATURE || @@ -1744,8 +1746,10 @@ dbus_message_append_args_valist (DBusMessage *message, { if (!dbus_message_iter_append_basic (&array, element_type, - &value[i])) + &value[i])) { + dbus_message_iter_abandon_container (&iter, &array); goto failed; + } ++i; } } @@ -2397,6 +2401,35 @@ _dbus_message_iter_close_signature (DBusMessageRealIter *real) return retval; } +/** + * Frees the signature string and marks the iterator as not having a + * type_str anymore. Since the new signature is not set, the message + * will generally be hosed after this is called. + * + * @param real an iterator without a type_str + */ +static void +_dbus_message_iter_abandon_signature (DBusMessageRealIter *real) +{ + DBusString *str; + + _dbus_assert (real->iter_type == DBUS_MESSAGE_ITER_TYPE_WRITER); + _dbus_assert (real->u.writer.type_str != NULL); + _dbus_assert (real->sig_refcount > 0); + + real->sig_refcount -= 1; + + if (real->sig_refcount > 0) + return; + _dbus_assert (real->sig_refcount == 0); + + str = real->u.writer.type_str; + + _dbus_type_writer_remove_types (&real->u.writer); + _dbus_string_free (str); + dbus_free (str); +} + #ifndef DBUS_DISABLE_CHECKS static dbus_bool_t _dbus_message_iter_append_check (DBusMessageRealIter *iter) @@ -2710,6 +2743,32 @@ dbus_message_iter_close_container (DBusMessageIter *iter, } /** + * Abandons creation of a contained-typed value and frees resources created + * by dbus_message_iter_open_container(). Once this returns, the message + * is hosed and you have to start over building the whole message. + * + * This should only be used to abandon creation of a message when you have + * open containers. + * + * @param iter the append iterator + * @param sub sub-iterator to close + */ +void +dbus_message_iter_abandon_container (DBusMessageIter *iter, + DBusMessageIter *sub) +{ + DBusMessageRealIter *real = (DBusMessageRealIter *)iter; + DBusMessageRealIter *real_sub = (DBusMessageRealIter *)sub; + + _dbus_return_if_fail (_dbus_message_iter_append_check (real)); + _dbus_return_if_fail (real->iter_type == DBUS_MESSAGE_ITER_TYPE_WRITER); + _dbus_return_if_fail (_dbus_message_iter_append_check (real_sub)); + _dbus_return_if_fail (real_sub->iter_type == DBUS_MESSAGE_ITER_TYPE_WRITER); + + _dbus_message_iter_abandon_signature (real); +} + +/** * Sets a flag indicating that the message does not want a reply; if * this flag is set, the other end of the connection may (but is not * required to) optimize by not sending method return or error @@ -4413,6 +4472,7 @@ dbus_message_marshal (DBusMessage *msg, int *len_p) { DBusString tmp; + dbus_bool_t was_locked; _dbus_return_val_if_fail (msg != NULL, FALSE); _dbus_return_val_if_fail (marshalled_data_p != NULL, FALSE); @@ -4421,6 +4481,12 @@ dbus_message_marshal (DBusMessage *msg, if (!_dbus_string_init (&tmp)) return FALSE; + /* Ensure the message is locked, to ensure the length header is filled in. */ + was_locked = msg->locked; + + if (!was_locked) + dbus_message_lock (msg); + if (!_dbus_string_copy (&(msg->header.data), 0, &tmp, 0)) goto fail; @@ -4435,10 +4501,18 @@ dbus_message_marshal (DBusMessage *msg, goto fail; _dbus_string_free (&tmp); + + if (!was_locked) + msg->locked = FALSE; + return TRUE; fail: _dbus_string_free (&tmp); + + if (!was_locked) + msg->locked = FALSE; + return FALSE; } diff --git a/dbus/dbus-message.h b/dbus/dbus-message.h index 3a3ddd96..a89fcd5e 100644 --- a/dbus/dbus-message.h +++ b/dbus/dbus-message.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) @@ -198,6 +198,8 @@ dbus_bool_t dbus_message_iter_open_container (DBusMessageIter *iter, DBusMessageIter *sub); dbus_bool_t dbus_message_iter_close_container (DBusMessageIter *iter, DBusMessageIter *sub); +void dbus_message_iter_abandon_container (DBusMessageIter *iter, + DBusMessageIter *sub); void dbus_message_lock (DBusMessage *message); diff --git a/dbus/dbus-misc.c b/dbus/dbus-misc.c index 758e1a02..b1610133 100644 --- a/dbus/dbus-misc.c +++ b/dbus/dbus-misc.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-misc.h b/dbus/dbus-misc.h index c59ce709..f8cb12ff 100644 --- a/dbus/dbus-misc.h +++ b/dbus/dbus-misc.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/dbus/dbus-object-tree.c b/dbus/dbus-object-tree.c index 953aa3bd..4309d154 100644 --- a/dbus/dbus-object-tree.c +++ b/dbus/dbus-object-tree.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-object-tree.h" diff --git a/dbus/dbus-object-tree.h b/dbus/dbus-object-tree.h index 1166752c..022dd93f 100644 --- a/dbus/dbus-object-tree.h +++ b/dbus/dbus-object-tree.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_OBJECT_TREE_H diff --git a/dbus/dbus-pending-call-internal.h b/dbus/dbus-pending-call-internal.h index 05374a6d..1875eea8 100644 --- a/dbus/dbus-pending-call-internal.h +++ b/dbus/dbus-pending-call-internal.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_PENDING_CALL_INTERNAL_H diff --git a/dbus/dbus-pending-call.c b/dbus/dbus-pending-call.c index 51b93787..43fad052 100644 --- a/dbus/dbus-pending-call.c +++ b/dbus/dbus-pending-call.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -83,7 +83,7 @@ static dbus_int32_t notify_user_data_slot = -1; * Creates a new pending reply object. * * @param connection connection where reply will arrive - * @param timeout_milliseconds length of timeout, -1 for default + * @param timeout_milliseconds length of timeout, -1 for default, INT_MAX for no timeout * @param timeout_handler timeout handler, takes pending call as data * @returns a new #DBusPendingCall or #NULL if no memory. */ @@ -100,14 +100,6 @@ _dbus_pending_call_new_unlocked (DBusConnection *connection, if (timeout_milliseconds == -1) timeout_milliseconds = _DBUS_DEFAULT_TIMEOUT_VALUE; - /* it would probably seem logical to pass in _DBUS_INT_MAX for - * infinite timeout, but then math in - * _dbus_connection_block_for_reply would get all overflow-prone, so - * smack that down. - */ - if (timeout_milliseconds > _DBUS_ONE_HOUR_IN_MILLISECONDS * 6) - timeout_milliseconds = _DBUS_ONE_HOUR_IN_MILLISECONDS * 6; - if (!dbus_pending_call_allocate_data_slot (¬ify_user_data_slot)) return NULL; @@ -119,24 +111,30 @@ _dbus_pending_call_new_unlocked (DBusConnection *connection, return NULL; } - timeout = _dbus_timeout_new (timeout_milliseconds, - timeout_handler, - pending, NULL); - - if (timeout == NULL) + if (timeout_milliseconds != _DBUS_INT_MAX) { - dbus_pending_call_free_data_slot (¬ify_user_data_slot); - dbus_free (pending); - return NULL; + timeout = _dbus_timeout_new (timeout_milliseconds, + timeout_handler, + pending, NULL); + + if (timeout == NULL) + { + dbus_pending_call_free_data_slot (¬ify_user_data_slot); + dbus_free (pending); + return NULL; + } + + pending->timeout = timeout; } - + else + { + pending->timeout = NULL; + } + pending->refcount.value = 1; pending->connection = connection; _dbus_connection_ref_unlocked (pending->connection); - pending->timeout = timeout; - - _dbus_data_slot_list_init (&pending->slot_list); return pending; @@ -255,7 +253,7 @@ _dbus_pending_call_set_timeout_added_unlocked (DBusPendingCall *pending, * Retrives the timeout * * @param pending the pending_call - * @returns a timeout object + * @returns a timeout object or NULL if call has no timeout */ DBusTimeout * _dbus_pending_call_get_timeout_unlocked (DBusPendingCall *pending) diff --git a/dbus/dbus-pending-call.h b/dbus/dbus-pending-call.h index b49e08d5..b1b4e235 100644 --- a/dbus/dbus-pending-call.h +++ b/dbus/dbus-pending-call.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/dbus/dbus-protocol.h b/dbus/dbus-protocol.h index 117195cd..a2284ee5 100644 --- a/dbus/dbus-protocol.h +++ b/dbus/dbus-protocol.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-resources.c b/dbus/dbus-resources.c index e6dcde1b..7c7aabd0 100644 --- a/dbus/dbus-resources.c +++ b/dbus/dbus-resources.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include <dbus/dbus-resources.h> diff --git a/dbus/dbus-resources.h b/dbus/dbus-resources.h index cf3cc1a6..4763a97f 100644 --- a/dbus/dbus-resources.h +++ b/dbus/dbus-resources.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_RESOURCES_H diff --git a/dbus/dbus-server-debug-pipe.c b/dbus/dbus-server-debug-pipe.c index b59f7491..8ba6fb6b 100644 --- a/dbus/dbus-server-debug-pipe.c +++ b/dbus/dbus-server-debug-pipe.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-server-debug-pipe.h b/dbus/dbus-server-debug-pipe.h index e86ec5e9..4574311d 100644 --- a/dbus/dbus-server-debug-pipe.h +++ b/dbus/dbus-server-debug-pipe.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_SERVER_DEBUG_PIPE_H diff --git a/dbus/dbus-server-protected.h b/dbus/dbus-server-protected.h index e8ef37a1..c05d2779 100644 --- a/dbus/dbus-server-protected.h +++ b/dbus/dbus-server-protected.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_SERVER_PROTECTED_H diff --git a/dbus/dbus-server-socket.c b/dbus/dbus-server-socket.c index b663e49d..132fdb7c 100644 --- a/dbus/dbus-server-socket.c +++ b/dbus/dbus-server-socket.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-server-socket.h b/dbus/dbus-server-socket.h index 34900b43..5918658e 100644 --- a/dbus/dbus-server-socket.h +++ b/dbus/dbus-server-socket.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_SERVER_SOCKET_H diff --git a/dbus/dbus-server-unix.c b/dbus/dbus-server-unix.c index 86a64c86..07800c8c 100644 --- a/dbus/dbus-server-unix.c +++ b/dbus/dbus-server-unix.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-server-unix.h b/dbus/dbus-server-unix.h index 34f5a712..92b996ca 100644 --- a/dbus/dbus-server-unix.h +++ b/dbus/dbus-server-unix.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_SERVER_UNIX_H diff --git a/dbus/dbus-server-win.c b/dbus/dbus-server-win.c index 38b56315..d6acc1e7 100644 --- a/dbus/dbus-server-win.c +++ b/dbus/dbus-server-win.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-server-win.h b/dbus/dbus-server-win.h index 591edded..65c27568 100644 --- a/dbus/dbus-server-win.h +++ b/dbus/dbus-server-win.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_SERVER_WIN_H diff --git a/dbus/dbus-server.c b/dbus/dbus-server.c index f04829b6..974503bb 100644 --- a/dbus/dbus-server.c +++ b/dbus/dbus-server.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-server.h b/dbus/dbus-server.h index 77f87880..6d7d2fa2 100644 --- a/dbus/dbus-server.h +++ b/dbus/dbus-server.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/dbus/dbus-sha.c b/dbus/dbus-sha.c index eb3439f8..04e353a0 100644 --- a/dbus/dbus-sha.c +++ b/dbus/dbus-sha.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-sha.h b/dbus/dbus-sha.h index 5895bb1b..c48035b9 100644 --- a/dbus/dbus-sha.h +++ b/dbus/dbus-sha.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_SHA_H diff --git a/dbus/dbus-shared.h b/dbus/dbus-shared.h index b59ed342..6a576704 100644 --- a/dbus/dbus-shared.h +++ b/dbus/dbus-shared.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-shell.c b/dbus/dbus-shell.c index 65038b11..57900d88 100644 --- a/dbus/dbus-shell.c +++ b/dbus/dbus-shell.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-shell.h b/dbus/dbus-shell.h index 5316d511..06da274e 100644 --- a/dbus/dbus-shell.h +++ b/dbus/dbus-shell.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-signature.c b/dbus/dbus-signature.c index b1e69315..b2d0a627 100644 --- a/dbus/dbus-signature.c +++ b/dbus/dbus-signature.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-signature.h b/dbus/dbus-signature.h index 37391088..ef3c6f99 100644 --- a/dbus/dbus-signature.h +++ b/dbus/dbus-signature.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/dbus/dbus-sockets-win.h b/dbus/dbus-sockets-win.h index 371672e2..881a1270 100644 --- a/dbus/dbus-sockets-win.h +++ b/dbus/dbus-sockets-win.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-spawn-win.c b/dbus/dbus-spawn-win.c index c2ad16bb..5c0c2999 100644 --- a/dbus/dbus-spawn-win.c +++ b/dbus/dbus-spawn-win.c @@ -34,7 +34,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-spawn.h" diff --git a/dbus/dbus-spawn.c b/dbus/dbus-spawn.c index fa2e15c1..c3c2fb99 100644 --- a/dbus/dbus-spawn.c +++ b/dbus/dbus-spawn.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-spawn.h b/dbus/dbus-spawn.h index 7d8a67a7..5af54b72 100644 --- a/dbus/dbus-spawn.h +++ b/dbus/dbus-spawn.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-string-private.h b/dbus/dbus-string-private.h index 16d7196b..6687a76f 100644 --- a/dbus/dbus-string-private.h +++ b/dbus/dbus-string-private.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-string-util.c b/dbus/dbus-string-util.c index aed94878..a3e5213e 100644 --- a/dbus/dbus-string-util.c +++ b/dbus/dbus-string-util.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-string.c b/dbus/dbus-string.c index 6b9b2bfe..b7a8b992 100644 --- a/dbus/dbus-string.c +++ b/dbus/dbus-string.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-string.h b/dbus/dbus-string.h index 374f0a86..b1850274 100644 --- a/dbus/dbus-string.h +++ b/dbus/dbus-string.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-sysdeps-pthread.c b/dbus/dbus-sysdeps-pthread.c index 121ee128..46e4204d 100644 --- a/dbus/dbus-sysdeps-pthread.c +++ b/dbus/dbus-sysdeps-pthread.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -33,6 +33,15 @@ #include <errno.h> #endif +#include <config.h> + +/* Whether we have a "monotonic" clock; i.e. a clock not affected by + * changes in system time. + * This is initialized once in check_monotonic_clock below. + * https://bugs.freedesktop.org/show_bug.cgi?id=18121 + */ +static dbus_bool_t have_monotonic_clock = 0; + typedef struct { pthread_mutex_t lock; /**< lock protecting count field */ volatile int count; /**< count of how many times lock holder has recursively locked */ @@ -184,13 +193,21 @@ static DBusCondVar * _dbus_pthread_condvar_new (void) { DBusCondVarPThread *pcond; + pthread_condattr_t attr; int result; pcond = dbus_new (DBusCondVarPThread, 1); if (pcond == NULL) return NULL; - result = pthread_cond_init (&pcond->cond, NULL); + pthread_condattr_init (&attr); +#ifdef HAVE_MONOTONIC_CLOCK + if (have_monotonic_clock) + pthread_condattr_setclock (&attr, CLOCK_MONOTONIC); +#endif + + result = pthread_cond_init (&pcond->cond, &attr); + pthread_condattr_destroy (&attr); if (result == EAGAIN || result == ENOMEM) { @@ -248,7 +265,18 @@ _dbus_pthread_condvar_wait_timeout (DBusCondVar *cond, _dbus_assert (pmutex->count > 0); _dbus_assert (pthread_equal (pmutex->holder, pthread_self ())); - + +#ifdef HAVE_MONOTONIC_CLOCK + if (have_monotonic_clock) + { + struct timespec monotonic_timer; + clock_gettime (CLOCK_MONOTONIC,&monotonic_timer); + time_now.tv_sec = monotonic_timer.tv_sec; + time_now.tv_usec = monotonic_timer.tv_nsec / 1000; + } + else + /* This else falls through to gettimeofday */ +#endif gettimeofday (&time_now, NULL); end_time.tv_sec = time_now.tv_sec + timeout_milliseconds / 1000; @@ -317,8 +345,19 @@ static const DBusThreadFunctions pthread_functions = _dbus_pthread_mutex_unlock }; +static void +check_monotonic_clock (void) +{ +#ifdef HAVE_MONOTONIC_CLOCK + struct timespec dummy; + if (clock_getres (CLOCK_MONOTONIC, &dummy) == 0) + have_monotonic_clock = TRUE; +#endif +} + dbus_bool_t _dbus_threads_init_platform_specific (void) { + check_monotonic_clock (); return dbus_threads_init (&pthread_functions); } diff --git a/dbus/dbus-sysdeps-thread-win.c b/dbus/dbus-sysdeps-thread-win.c index 34f09480..a4f45c0c 100644 --- a/dbus/dbus-sysdeps-thread-win.c +++ b/dbus/dbus-sysdeps-thread-win.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 42aa9674..f0f1e706 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -1373,9 +1373,9 @@ write_credentials_byte (int server_fd, int bytes_written; char buf[1] = { '\0' }; #if defined(HAVE_CMSGCRED) - struct { + union { struct cmsghdr hdr; - struct cmsgcred cred; + char cred[CMSG_SPACE (sizeof (struct cmsgcred))]; } cmsg; struct iovec iov; struct msghdr msg; @@ -1386,10 +1386,10 @@ write_credentials_byte (int server_fd, msg.msg_iov = &iov; msg.msg_iovlen = 1; - msg.msg_control = &cmsg; - msg.msg_controllen = sizeof (cmsg); + msg.msg_control = (caddr_t) &cmsg; + msg.msg_controllen = CMSG_SPACE (sizeof (struct cmsgcred)); _DBUS_ZERO(cmsg); - cmsg.hdr.cmsg_len = sizeof (cmsg); + cmsg.hdr.cmsg_len = CMSG_LEN (sizeof (struct cmsgcred)); cmsg.hdr.cmsg_level = SOL_SOCKET; cmsg.hdr.cmsg_type = SCM_CREDS; #endif @@ -1461,13 +1461,10 @@ _dbus_read_credentials_socket (int client_fd, dbus_pid_t pid_read; int bytes_read; - uid_read = DBUS_UID_UNSET; - pid_read = DBUS_PID_UNSET; - #ifdef HAVE_CMSGCRED - struct { + union { struct cmsghdr hdr; - struct cmsgcred cred; + char cred[CMSG_SPACE (sizeof (struct cmsgcred))]; } cmsg; #elif defined(LOCAL_CREDS) @@ -1477,6 +1474,9 @@ _dbus_read_credentials_socket (int client_fd, } cmsg; #endif + uid_read = DBUS_UID_UNSET; + pid_read = DBUS_PID_UNSET; + _DBUS_ASSERT_ERROR_IS_CLEAR (error); /* The POSIX spec certainly doesn't promise this, but @@ -1504,8 +1504,8 @@ _dbus_read_credentials_socket (int client_fd, #if defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS) _DBUS_ZERO(cmsg); - msg.msg_control = &cmsg; - msg.msg_controllen = sizeof (cmsg); + msg.msg_control = (caddr_t) &cmsg; + msg.msg_controllen = CMSG_SPACE (sizeof (struct cmsgcred)); #endif again: @@ -1543,7 +1543,8 @@ _dbus_read_credentials_socket (int client_fd, } #if defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS) - if (cmsg.hdr.cmsg_len < sizeof (cmsg) || cmsg.hdr.cmsg_type != SCM_CREDS) + if (cmsg.hdr.cmsg_len < CMSG_LEN (sizeof (struct cmsgcred)) + || cmsg.hdr.cmsg_type != SCM_CREDS) { dbus_set_error (error, DBUS_ERROR_FAILED, "Message from recvmsg() was not SCM_CREDS"); @@ -1570,8 +1571,11 @@ _dbus_read_credentials_socket (int client_fd, cr_len, (int) sizeof (cr), _dbus_strerror (errno)); } #elif defined(HAVE_CMSGCRED) - pid_read = cmsg.cred.cmcred_pid; - uid_read = cmsg.cred.cmcred_euid; + struct cmsgcred *cred; + + cred = (struct cmsgcred *) CMSG_DATA (&cmsg); + pid_read = cred->cmcred_pid; + uid_read = cred->cmcred_euid; #elif defined(LOCAL_CREDS) pid_read = DBUS_PID_UNSET; uid_read = cmsg.cred.sc_uid; @@ -1945,8 +1949,10 @@ fill_user_info (DBusUserInfo *info, gid_t *buf; int buf_count; int i; - - buf_count = 17; + int initial_buf_count; + + initial_buf_count = 17; + buf_count = initial_buf_count; buf = dbus_new (gid_t, buf_count); if (buf == NULL) { @@ -1958,7 +1964,25 @@ fill_user_info (DBusUserInfo *info, info->primary_gid, buf, &buf_count) < 0) { - gid_t *new = dbus_realloc (buf, buf_count * sizeof (buf[0])); + gid_t *new; + /* Presumed cause of negative return code: buf has insufficient + entries to hold the entire group list. The Linux behavior in this + case is to pass back the actual number of groups in buf_count, but + on Mac OS X 10.5, buf_count is unhelpfully left alone. + So as a hack, try to help out a bit by guessing a larger + number of groups, within reason.. might still fail, of course, + but we can at least print a more informative message. I looked up + the "right way" to do this by downloading Apple's own source code + for the "id" command, and it turns out that they use an + undocumented library function getgrouplist_2 (!) which is not + declared in any header in /usr/include (!!). That did not seem + like the way to go here. + */ + if (buf_count == initial_buf_count) + { + buf_count *= 16; /* Retry with an arbitrarily scaled-up array */ + } + new = dbus_realloc (buf, buf_count * sizeof (buf[0])); if (new == NULL) { dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); @@ -1971,14 +1995,22 @@ fill_user_info (DBusUserInfo *info, errno = 0; if (getgrouplist (username_c, info->primary_gid, buf, &buf_count) < 0) { - dbus_set_error (error, - _dbus_error_from_errno (errno), - "Failed to get groups for username \"%s\" primary GID " - DBUS_GID_FORMAT ": %s\n", - username_c, info->primary_gid, - _dbus_strerror (errno)); - dbus_free (buf); - goto failed; + if (errno == 0) + { + _dbus_warn ("It appears that username \"%s\" is in more than %d groups.\nProceeding with just the first %d groups.", + username_c, buf_count, buf_count); + } + else + { + dbus_set_error (error, + _dbus_error_from_errno (errno), + "Failed to get groups for username \"%s\" primary GID " + DBUS_GID_FORMAT ": %s\n", + username_c, info->primary_gid, + _dbus_strerror (errno)); + dbus_free (buf); + goto failed; + } } } @@ -3235,83 +3267,73 @@ _dbus_get_tmpdir(void) } /** - * Determines the address of the session bus by querying a - * platform-specific method. + * Execute a subprocess, returning up to 1024 bytes of output + * into @p result. * - * If successful, returns #TRUE and appends the address to @p - * address. If a failure happens, returns #FALSE and + * If successful, returns #TRUE and appends the output to @p + * result. If a failure happens, returns #FALSE and * sets an error in @p error. * - * @param address a DBusString where the address can be stored + * @note It's not an error if the subprocess terminates normally + * without writing any data to stdout. Verify the @p result length + * before and after this function call to cover this case. + * + * @param progname initial path to exec (may or may not be absolute) + * @param path_fallback if %TRUE, search PATH for executable + * @param argv NULL-terminated list of arguments + * @param result a DBusString where the output can be append * @param error a DBusError to store the error in case of failure * @returns #TRUE on success, #FALSE if an error happened */ -dbus_bool_t -_dbus_get_autolaunch_address (DBusString *address, - DBusError *error) +static dbus_bool_t +_read_subprocess_line_argv (const char *progpath, + dbus_bool_t path_fallback, + char * const *argv, + DBusString *result, + DBusError *error) { - static char *argv[6]; - int address_pipe[2] = { -1, -1 }; + int result_pipe[2] = { -1, -1 }; int errors_pipe[2] = { -1, -1 }; pid_t pid; int ret; int status; int orig_len; int i; - DBusString uuid; + dbus_bool_t retval; + sigset_t new_set, old_set; _DBUS_ASSERT_ERROR_IS_CLEAR (error); retval = FALSE; - if (!_dbus_string_init (&uuid)) - { - _DBUS_SET_OOM (error); - return FALSE; - } - - if (!_dbus_get_local_machine_uuid_encoded (&uuid)) - { - _DBUS_SET_OOM (error); - goto out; - } - - i = 0; - argv[i] = "dbus-launch"; - ++i; - argv[i] = "--autolaunch"; - ++i; - argv[i] = _dbus_string_get_data (&uuid); - ++i; - argv[i] = "--binary-syntax"; - ++i; - argv[i] = "--close-stderr"; - ++i; - argv[i] = NULL; - ++i; - - _dbus_assert (i == _DBUS_N_ELEMENTS (argv)); + /* We need to block any existing handlers for SIGCHLD temporarily; they + * will cause waitpid() below to fail. + * https://bugs.freedesktop.org/show_bug.cgi?id=21347 + */ + sigemptyset (&new_set); + sigaddset (&new_set, SIGCHLD); + sigprocmask (SIG_BLOCK, &new_set, &old_set); - orig_len = _dbus_string_get_length (address); + orig_len = _dbus_string_get_length (result); #define READ_END 0 #define WRITE_END 1 - if (pipe (address_pipe) < 0) + if (pipe (result_pipe) < 0) { dbus_set_error (error, _dbus_error_from_errno (errno), - "Failed to create a pipe: %s", - _dbus_strerror (errno)); - _dbus_verbose ("Failed to create a pipe to call dbus-launch: %s\n", - _dbus_strerror (errno)); + "Failed to create a pipe to call %s: %s", + progpath, _dbus_strerror (errno)); + _dbus_verbose ("Failed to create a pipe to call %s: %s\n", + progpath, _dbus_strerror (errno)); goto out; } if (pipe (errors_pipe) < 0) { dbus_set_error (error, _dbus_error_from_errno (errno), - "Failed to create a pipe: %s", - _dbus_strerror (errno)); - _dbus_verbose ("Failed to create a pipe to call dbus-launch: %s\n", - _dbus_strerror (errno)); + "Failed to create a pipe to call %s: %s", + progpath, _dbus_strerror (errno)); + _dbus_verbose ("Failed to create a pipe to call %s: %s\n", + progpath, _dbus_strerror (errno)); goto out; } @@ -3319,10 +3341,10 @@ _dbus_get_autolaunch_address (DBusString *address, if (pid < 0) { dbus_set_error (error, _dbus_error_from_errno (errno), - "Failed to fork(): %s", - _dbus_strerror (errno)); - _dbus_verbose ("Failed to fork() to call dbus-launch: %s\n", - _dbus_strerror (errno)); + "Failed to fork() to call %s: %s", + progpath, _dbus_strerror (errno)); + _dbus_verbose ("Failed to fork() to call %s: %s\n", + progpath, _dbus_strerror (errno)); goto out; } @@ -3340,7 +3362,7 @@ _dbus_get_autolaunch_address (DBusString *address, _dbus_verbose ("/dev/null fd %d opened\n", fd); /* set-up stdXXX */ - close (address_pipe[READ_END]); + close (result_pipe[READ_END]); close (errors_pipe[READ_END]); close (0); /* close stdin */ close (1); /* close stdout */ @@ -3348,7 +3370,7 @@ _dbus_get_autolaunch_address (DBusString *address, if (dup2 (fd, 0) == -1) _exit (1); - if (dup2 (address_pipe[WRITE_END], 1) == -1) + if (dup2 (result_pipe[WRITE_END], 1) == -1) _exit (1); if (dup2 (errors_pipe[WRITE_END], 2) == -1) _exit (1); @@ -3363,25 +3385,39 @@ _dbus_get_autolaunch_address (DBusString *address, for (i = 3; i < maxfds; i++) close (i); - execv (DBUS_BINDIR "/dbus-launch", argv); + sigprocmask (SIG_SETMASK, &old_set, NULL); - /* failed, try searching PATH */ - execvp ("dbus-launch", argv); + /* If it looks fully-qualified, try execv first */ + if (progpath[0] == '/') + { + execv (progpath, argv); + /* Ok, that failed. Now if path_fallback is given, let's + * try unqualified. This is mostly a hack to work + * around systems which ship dbus-launch in /usr/bin + * but everything else in /bin (because dbus-launch + * depends on X11). + */ + if (path_fallback) + /* We must have a slash, because we checked above */ + execvp (strrchr (progpath, '/')+1, argv); + } + else + execvp (progpath, argv); /* still nothing, we failed */ _exit (1); } /* parent process */ - close (address_pipe[WRITE_END]); + close (result_pipe[WRITE_END]); close (errors_pipe[WRITE_END]); - address_pipe[WRITE_END] = -1; + result_pipe[WRITE_END] = -1; errors_pipe[WRITE_END] = -1; ret = 0; do { - ret = _dbus_read (address_pipe[READ_END], address, 1024); + ret = _dbus_read (result_pipe[READ_END], result, 1024); } while (ret > 0); @@ -3394,47 +3430,108 @@ _dbus_get_autolaunch_address (DBusString *address, /* We succeeded if the process exited with status 0 and anything was read */ - if (!WIFEXITED (status) || WEXITSTATUS (status) != 0 || - _dbus_string_get_length (address) == orig_len) + if (!WIFEXITED (status) || WEXITSTATUS (status) != 0 ) { /* The process ended with error */ DBusString error_message; _dbus_string_init (&error_message); ret = 0; do - { - ret = _dbus_read (errors_pipe[READ_END], &error_message, 1024); - } + { + ret = _dbus_read (errors_pipe[READ_END], &error_message, 1024); + } while (ret > 0); - _dbus_string_set_length (address, orig_len); + _dbus_string_set_length (result, orig_len); if (_dbus_string_get_length (&error_message) > 0) - dbus_set_error (error, DBUS_ERROR_SPAWN_EXEC_FAILED, - "dbus-launch failed to autolaunch D-Bus session: %s", - _dbus_string_get_data (&error_message)); + dbus_set_error (error, DBUS_ERROR_SPAWN_EXEC_FAILED, + "%s terminated abnormally with the following error: %s", + progpath, _dbus_string_get_data (&error_message)); else - dbus_set_error (error, DBUS_ERROR_SPAWN_EXEC_FAILED, - "Failed to execute dbus-launch to autolaunch D-Bus session"); + dbus_set_error (error, DBUS_ERROR_SPAWN_EXEC_FAILED, + "%s terminated abnormally without any error message", + progpath); goto out; } retval = TRUE; out: + sigprocmask (SIG_SETMASK, &old_set, NULL); + if (retval) _DBUS_ASSERT_ERROR_IS_CLEAR (error); else _DBUS_ASSERT_ERROR_IS_SET (error); - if (address_pipe[0] != -1) - close (address_pipe[0]); - if (address_pipe[1] != -1) - close (address_pipe[1]); + if (result_pipe[0] != -1) + close (result_pipe[0]); + if (result_pipe[1] != -1) + close (result_pipe[1]); if (errors_pipe[0] != -1) close (errors_pipe[0]); if (errors_pipe[1] != -1) close (errors_pipe[1]); + return retval; +} + +/** + * Returns the address of a new session bus. + * + * If successful, returns #TRUE and appends the address to @p + * address. If a failure happens, returns #FALSE and + * sets an error in @p error. + * + * @param address a DBusString where the address can be stored + * @param error a DBusError to store the error in case of failure + * @returns #TRUE on success, #FALSE if an error happened + */ +dbus_bool_t +_dbus_get_autolaunch_address (DBusString *address, + DBusError *error) +{ + static char *argv[6]; + int i; + DBusString uuid; + dbus_bool_t retval; + + _DBUS_ASSERT_ERROR_IS_CLEAR (error); + retval = FALSE; + + if (!_dbus_string_init (&uuid)) + { + _DBUS_SET_OOM (error); + return FALSE; + } + + if (!_dbus_get_local_machine_uuid_encoded (&uuid)) + { + _DBUS_SET_OOM (error); + goto out; + } + + i = 0; + argv[i] = "dbus-launch"; + ++i; + argv[i] = "--autolaunch"; + ++i; + argv[i] = _dbus_string_get_data (&uuid); + ++i; + argv[i] = "--binary-syntax"; + ++i; + argv[i] = "--close-stderr"; + ++i; + argv[i] = NULL; + ++i; + + _dbus_assert (i == _DBUS_N_ELEMENTS (argv)); + + retval = _read_subprocess_line_argv (DBUS_BINDIR "/dbus-launch", + TRUE, + argv, address, error); + + out: _dbus_string_free (&uuid); return retval; } @@ -3470,6 +3567,37 @@ _dbus_read_local_machine_uuid (DBusGUID *machine_id, #define DBUS_UNIX_STANDARD_SESSION_SERVICEDIR "/dbus-1/services" #define DBUS_UNIX_STANDARD_SYSTEM_SERVICEDIR "/dbus-1/system-services" +/** + * Determines the address of the session bus by querying a + * platform-specific method. + * + * The first parameter will be a boolean specifying whether + * or not a dynamic session lookup is supported on this platform. + * + * If supported is TRUE and the return value is #TRUE, the + * address will be appended to @p address. + * If a failure happens, returns #FALSE and sets an error in + * @p error. + * + * If supported is FALSE, ignore the return value. + * + * @param supported returns whether this method is supported + * @param address a DBusString where the address can be stored + * @param error a DBusError to store the error in case of failure + * @returns #TRUE on success, #FALSE if an error happened + */ +dbus_bool_t +_dbus_lookup_session_address (dbus_bool_t *supported, + DBusString *address, + DBusError *error) +{ + /* On non-Mac Unix platforms, if the session address isn't already + * set in DBUS_SESSION_BUS_ADDRESS environment variable, we punt and + * fall back to the autolaunch: global default; see + * init_session_address in dbus/dbus-bus.c. */ + *supported = FALSE; + return TRUE; +} /** * Returns the standard directories for a session bus to look for service diff --git a/dbus/dbus-sysdeps-unix.h b/dbus/dbus-sysdeps-unix.h index 5b7723a2..96b44e29 100644 --- a/dbus/dbus-sysdeps-unix.h +++ b/dbus/dbus-sysdeps-unix.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index f1e20334..9fa27a1a 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-sysdeps.h" @@ -1149,10 +1149,13 @@ string_squash_nonprintable (DBusString *str) len = _dbus_string_get_length (str); for (i = 0; i < len; i++) - if (buf[i] == '\0') - buf[i] = ' '; - else if (buf[i] < 0x20 || buf[i] > 127) - buf[i] = '?'; + { + unsigned char c = (unsigned char) buf[i]; + if (c == '\0') + c = ' '; + else if (c < 0x20 || c > 127) + c = '?'; + } } /** diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c index 6358531b..b0e4eabb 100644 --- a/dbus/dbus-sysdeps-util-win.c +++ b/dbus/dbus-sysdeps-util-win.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-sysdeps-util.c b/dbus/dbus-sysdeps-util.c index 448f5c43..67e19f7b 100644 --- a/dbus/dbus-sysdeps-util.c +++ b/dbus/dbus-sysdeps-util.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-sysdeps.h" diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index 507f2c00..4a42c761 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -5,7 +5,7 @@ * Copyright (C) 2003 CodeFactory AB * Copyright (C) 2005 Novell, Inc. * Copyright (C) 2006 Ralf Habacker <ralf.habacker@freenet.de> - * Copyright (C) 2006 Peter Kümmel <syntheticpp@gmx.net> + * Copyright (C) 2006 Peter Kümmel <syntheticpp@gmx.net> * Copyright (C) 2006 Christian Ehrlicher <ch.ehrlicher@gmx.de> * * Licensed under the Academic Free License version 2.1 @@ -22,7 +22,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -1422,7 +1422,7 @@ Original CVS version of dbus-sysdeps.c * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -2467,7 +2467,7 @@ _dbus_generate_random_bytes (DBusString *str, * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <winver.h> @@ -3281,6 +3281,17 @@ _dbus_append_session_config_file (DBusString *str) return _dbus_get_config_file_name(str, "session.conf"); } +/* See comment in dbus-sysdeps-unix.c */ +dbus_bool_t +_dbus_lookup_session_address (dbus_bool_t *supported, + DBusString *address, + DBusError *error) +{ + /* Probably fill this in with something based on COM? */ + *supported = FALSE; + return TRUE; +} + /** * Appends the directory in which a keyring for the given credentials * should be stored. The credentials should have either a Windows or diff --git a/dbus/dbus-sysdeps-win.h b/dbus/dbus-sysdeps-win.h index d2ce08af..161a819f 100644 --- a/dbus/dbus-sysdeps-win.h +++ b/dbus/dbus-sysdeps-win.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c index 00a1a3de..ccd80ccd 100644 --- a/dbus/dbus-sysdeps.c +++ b/dbus/dbus-sysdeps.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -1078,6 +1078,16 @@ _dbus_get_is_errno_eintr (void) } /** + * See if errno is EPIPE + * @returns #TRUE if errno == EPIPE + */ +dbus_bool_t +_dbus_get_is_errno_epipe (void) +{ + return errno == EPIPE; +} + +/** * Get error message from errno * @returns _dbus_strerror(errno) */ diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h index 6f47e48b..739a4546 100644 --- a/dbus/dbus-sysdeps.h +++ b/dbus/dbus-sysdeps.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -262,6 +262,19 @@ dbus_int32_t _dbus_atomic_dec (DBusAtomic *atomic); #define _DBUS_POLLHUP 0x2000 /** Invalid request: fd not open */ #define _DBUS_POLLNVAL 0x8000 +#elif defined(__HAIKU__) +/** There is data to read */ +#define _DBUS_POLLIN 0x0001 +/** Writing now will not block */ +#define _DBUS_POLLOUT 0x0002 +/** Error condition */ +#define _DBUS_POLLERR 0x0004 +/** There is urgent data to read */ +#define _DBUS_POLLPRI 0x0020 +/** Hung up */ +#define _DBUS_POLLHUP 0x0080 +/** Invalid request: fd not open */ +#define _DBUS_POLLNVAL 0x1000 #else /** There is data to read */ #define _DBUS_POLLIN 0x0001 @@ -386,6 +399,7 @@ dbus_bool_t _dbus_get_is_errno_nonzero (void); dbus_bool_t _dbus_get_is_errno_eagain_or_ewouldblock (void); dbus_bool_t _dbus_get_is_errno_enomem (void); dbus_bool_t _dbus_get_is_errno_eintr (void); +dbus_bool_t _dbus_get_is_errno_epipe (void); const char* _dbus_strerror_from_errno (void); void _dbus_disable_sigpipe (void); @@ -492,6 +506,10 @@ void _dbus_log_security (const char *msg, va_list args); dbus_bool_t _dbus_get_autolaunch_address (DBusString *address, DBusError *error); +dbus_bool_t _dbus_lookup_session_address (dbus_bool_t *supported, + DBusString *address, + DBusError *error); + /** Type representing a universally unique ID * @todo rename to UUID instead of GUID */ diff --git a/dbus/dbus-test-main.c b/dbus/dbus-test-main.c index e7fcc67b..1bb7c904 100644 --- a/dbus/dbus-test-main.c +++ b/dbus/dbus-test-main.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-test.c b/dbus/dbus-test.c index 180235fa..99becb0e 100644 --- a/dbus/dbus-test.c +++ b/dbus/dbus-test.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-test.h b/dbus/dbus-test.h index a7aaea66..0238b0ce 100644 --- a/dbus/dbus-test.h +++ b/dbus/dbus-test.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-threads-internal.h b/dbus/dbus-threads-internal.h index bcc4e6ba..11f9ce20 100644 --- a/dbus/dbus-threads-internal.h +++ b/dbus/dbus-threads-internal.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_THREADS_INTERNAL_H diff --git a/dbus/dbus-threads.c b/dbus/dbus-threads.c index cb9c7237..2e41ed96 100644 --- a/dbus/dbus-threads.c +++ b/dbus/dbus-threads.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-threads.h" diff --git a/dbus/dbus-threads.h b/dbus/dbus-threads.h index 8d9687de..1fd83f21 100644 --- a/dbus/dbus-threads.h +++ b/dbus/dbus-threads.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/dbus/dbus-timeout.c b/dbus/dbus-timeout.c index 5e71c4bb..0d92ca11 100644 --- a/dbus/dbus-timeout.c +++ b/dbus/dbus-timeout.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-timeout.h b/dbus/dbus-timeout.h index b2312ee8..d0a8af4a 100644 --- a/dbus/dbus-timeout.h +++ b/dbus/dbus-timeout.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_TIMEOUT_H diff --git a/dbus/dbus-transport-protected.h b/dbus/dbus-transport-protected.h index 50ec6ce0..a3c8f3e4 100644 --- a/dbus/dbus-transport-protected.h +++ b/dbus/dbus-transport-protected.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_TRANSPORT_PROTECTED_H diff --git a/dbus/dbus-transport-socket.c b/dbus/dbus-transport-socket.c index 8e13baeb..4b88af7c 100644 --- a/dbus/dbus-transport-socket.c +++ b/dbus/dbus-transport-socket.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -645,7 +645,11 @@ do_writing (DBusTransport *transport) { /* EINTR already handled for us */ - if (_dbus_get_is_errno_eagain_or_ewouldblock ()) + /* For some discussion of why we also ignore EPIPE here, see + * http://lists.freedesktop.org/archives/dbus/2008-March/009526.html + */ + + if (_dbus_get_is_errno_eagain_or_ewouldblock () || _dbus_get_is_errno_epipe ()) goto out; else { @@ -866,6 +870,25 @@ do_reading (DBusTransport *transport) } static dbus_bool_t +unix_error_with_read_to_come (DBusTransport *itransport, + DBusWatch *watch, + unsigned int flags) +{ + DBusTransportSocket *transport = (DBusTransportSocket *) itransport; + + if (!(flags & DBUS_WATCH_HANGUP || flags & DBUS_WATCH_ERROR)) + return FALSE; + + /* If we have a read watch enabled ... + we -might have data incoming ... => handle the HANGUP there */ + if (watch != transport->read_watch && + _dbus_watch_get_enabled (transport->read_watch)) + return FALSE; + + return TRUE; +} + +static dbus_bool_t socket_handle_watch (DBusTransport *transport, DBusWatch *watch, unsigned int flags) @@ -876,14 +899,11 @@ socket_handle_watch (DBusTransport *transport, watch == socket_transport->write_watch); _dbus_assert (watch != NULL); - /* Disconnect in case of an error. In case of hangup do not - * disconnect the transport because data can still be in the buffer - * and do_reading may need several iteration to read it all (because - * of its max_bytes_read_per_iteration limit). The condition where - * flags == HANGUP (without READABLE) probably never happen in fact. + /* If we hit an error here on a write watch, don't disconnect the transport yet because data can + * still be in the buffer and do_reading may need several iteration to read + * it all (because of its max_bytes_read_per_iteration limit). */ - if ((flags & DBUS_WATCH_ERROR) || - ((flags & DBUS_WATCH_HANGUP) && !(flags & DBUS_WATCH_READABLE))) + if (!(flags & DBUS_WATCH_READABLE) && unix_error_with_read_to_come (transport, watch, flags)) { _dbus_verbose ("Hang up or error on watch\n"); _dbus_transport_disconnect (transport); diff --git a/dbus/dbus-transport-socket.h b/dbus/dbus-transport-socket.h index 8a00ab58..eb833263 100644 --- a/dbus/dbus-transport-socket.h +++ b/dbus/dbus-transport-socket.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_TRANSPORT_SOCKET_H diff --git a/dbus/dbus-transport-unix.c b/dbus/dbus-transport-unix.c index 777c9411..2f2a3da5 100644 --- a/dbus/dbus-transport-unix.c +++ b/dbus/dbus-transport-unix.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-transport-unix.h b/dbus/dbus-transport-unix.h index 3807ed24..783a8313 100644 --- a/dbus/dbus-transport-unix.h +++ b/dbus/dbus-transport-unix.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_TRANSPORT_UNIX_H diff --git a/dbus/dbus-transport-win.c b/dbus/dbus-transport-win.c index 7807b344..6a99b070 100644 --- a/dbus/dbus-transport-win.c +++ b/dbus/dbus-transport-win.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-transport-win.h b/dbus/dbus-transport-win.h index 03674930..af997a27 100644 --- a/dbus/dbus-transport-win.h +++ b/dbus/dbus-transport-win.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_TRANSPORT_WIN_H diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c index 11edc6a8..3c67621d 100644 --- a/dbus/dbus-transport.c +++ b/dbus/dbus-transport.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-transport.h b/dbus/dbus-transport.h index 994bf6e3..0db048a2 100644 --- a/dbus/dbus-transport.h +++ b/dbus/dbus-transport.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_TRANSPORT_H diff --git a/dbus/dbus-types.h b/dbus/dbus-types.h index 0a272d41..54f348f3 100644 --- a/dbus/dbus-types.h +++ b/dbus/dbus-types.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) diff --git a/dbus/dbus-userdb-util.c b/dbus/dbus-userdb-util.c index d03a7c78..f75d1bc0 100644 --- a/dbus/dbus-userdb-util.c +++ b/dbus/dbus-userdb-util.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #define DBUS_USERDB_INCLUDES_PRIVATE 1 diff --git a/dbus/dbus-userdb.c b/dbus/dbus-userdb.c index 03d263f4..5a153c6a 100644 --- a/dbus/dbus-userdb.c +++ b/dbus/dbus-userdb.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #define DBUS_USERDB_INCLUDES_PRIVATE 1 diff --git a/dbus/dbus-userdb.h b/dbus/dbus-userdb.h index a1153eeb..cb49d9e7 100644 --- a/dbus/dbus-userdb.h +++ b/dbus/dbus-userdb.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/dbus/dbus-uuidgen.c b/dbus/dbus-uuidgen.c index 6f226bce..5c571e88 100644 --- a/dbus/dbus-uuidgen.c +++ b/dbus/dbus-uuidgen.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-uuidgen.h" diff --git a/dbus/dbus-uuidgen.h b/dbus/dbus-uuidgen.h index 3e30b996..9c1b8595 100644 --- a/dbus/dbus-uuidgen.h +++ b/dbus/dbus-uuidgen.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef DBUS_INSIDE_DBUS_H diff --git a/dbus/dbus-watch.c b/dbus/dbus-watch.c index 9d6ab7c3..bca699fd 100644 --- a/dbus/dbus-watch.c +++ b/dbus/dbus-watch.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -51,6 +51,12 @@ struct DBusWatch unsigned int enabled : 1; /**< Whether it's enabled. */ }; +dbus_bool_t +_dbus_watch_get_enabled (DBusWatch *watch) +{ + return watch->enabled; +} + /** * Creates a new DBusWatch. Used to add a file descriptor to be polled * by a main loop. diff --git a/dbus/dbus-watch.h b/dbus/dbus-watch.h index 1d8d3278..fa953ec1 100644 --- a/dbus/dbus-watch.h +++ b/dbus/dbus-watch.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_WATCH_H @@ -74,6 +74,7 @@ void _dbus_watch_list_remove_watch (DBusWatchList *watch_li void _dbus_watch_list_toggle_watch (DBusWatchList *watch_list, DBusWatch *watch, dbus_bool_t enabled); +dbus_bool_t _dbus_watch_get_enabled (DBusWatch *watch); /** @} */ diff --git a/dbus/dbus.h b/dbus/dbus.h index 880f21d4..1f099508 100644 --- a/dbus/dbus.h +++ b/dbus/dbus.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/doc/file-boilerplate.c b/doc/file-boilerplate.c index 9a155305..bc365f80 100644 --- a/doc/file-boilerplate.c +++ b/doc/file-boilerplate.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/doc/introspect.xsl b/doc/introspect.xsl index e892999a..2a344741 100644 --- a/doc/introspect.xsl +++ b/doc/introspect.xsl @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --> <!-- $Id$ --> diff --git a/test/break-loader.c b/test/break-loader.c index 4de8eb7f..8ed44320 100644 --- a/test/break-loader.c +++ b/test/break-loader.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/test/decode-gcov.c b/test/decode-gcov.c index eded8bc7..f26afd3e 100644 --- a/test/decode-gcov.c +++ b/test/decode-gcov.c @@ -23,7 +23,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/test/name-test/.gitignore b/test/name-test/.gitignore index 09930f11..7e4233e5 100644 --- a/test/name-test/.gitignore +++ b/test/name-test/.gitignore @@ -4,6 +4,7 @@ Makefile Makefile.in test-names test-pending-call-dispatch +test-pending-call-timeout test-threads-init test-ids run-with-tmp-session-bus.conf diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am index 10a2536d..1c73b877 100644 --- a/test/name-test/Makefile.am +++ b/test/name-test/Makefile.am @@ -16,7 +16,7 @@ if DBUS_BUILD_TESTS ## we use noinst_PROGRAMS not check_PROGRAMS for TESTS so that we ## build even when not doing "make check" -noinst_PROGRAMS=test-names test-pending-call-dispatch test-threads-init test-ids test-shutdown test-privserver test-privserver-client +noinst_PROGRAMS=test-names test-pending-call-dispatch test-pending-call-timeout test-threads-init test-ids test-shutdown test-privserver test-privserver-client test_names_SOURCES= \ test-names.c @@ -30,6 +30,12 @@ test_pending_call_dispatch_SOURCES = \ test_pending_call_dispatch_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_TEST_LIBS) test_pending_call_dispatch_LDFLAGS=@R_DYNAMIC_LDFLAG@ +test_pending_call_timeout_SOURCES = \ + test-pending-call-timeout.c + +test_pending_call_timeout_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_TEST_LIBS) +test_pending_call_timeout_LDFLAGS=@R_DYNAMIC_LDFLAG@ + test_threads_init_SOURCES = \ test-threads-init.c diff --git a/test/name-test/run-test.sh b/test/name-test/run-test.sh index 3699bc9a..fba45584 100755 --- a/test/name-test/run-test.sh +++ b/test/name-test/run-test.sh @@ -39,6 +39,9 @@ ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name- echo "running test-pending-call-dispatch" ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-pending-call-dispatch || die "test-pending-call-dispatch failed" +echo "running test-pending-call-timeout" +${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-pending-call-timeout || die "test-pending-call-timeout failed" + echo "running test-threads-init" ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-threads-init || die "test-threads-init failed" diff --git a/test/name-test/test-pending-call-timeout.c b/test/name-test/test-pending-call-timeout.c new file mode 100644 index 00000000..53a0c3a7 --- /dev/null +++ b/test/name-test/test-pending-call-timeout.c @@ -0,0 +1,102 @@ +/** +* Test to make sure that pending calls succeed when given a default, +* specific and infinite timeout. +**/ + +#include <dbus/dbus.h> +#include <dbus/dbus-sysdeps.h> +#include <stdio.h> +#include <limits.h> +#include <stdlib.h> + +static void +_method_call (DBusConnection *conn, + int timeout_milliseconds) +{ + DBusPendingCall *pending; + DBusMessage *method; + DBusMessage *reply; + char *echo = "echo"; + + /* send the message */ + method = dbus_message_new_method_call ("org.freedesktop.DBus.TestSuiteEchoService", + "/org/freedesktop/TestSuite", + "org.freedesktop.TestSuite", + "DelayEcho"); + + dbus_message_append_args (method, DBUS_TYPE_STRING, &echo, NULL); + dbus_connection_send_with_reply (conn, method, &pending, timeout_milliseconds); + dbus_message_unref (method); + + /* block on the message */ + dbus_pending_call_block (pending); + + /* check the reply only to make sure we + are not getting errors unrelated + to the block in poll bug */ + reply = dbus_pending_call_steal_reply (pending); + + if (reply == NULL) + { + printf ("Failed: Reply is NULL ***\n"); + exit (1); + } + + if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR) + { + printf ("Failed: Reply is error: %s ***\n", dbus_message_get_error_name (reply)); + exit (1); + } + + dbus_message_unref (reply); + dbus_pending_call_unref (pending); +} + +static void +_run_iteration (DBusConnection *conn) +{ + _method_call (conn, -1); + _method_call (conn, 10000); + _method_call (conn, INT_MAX); +} + +int +main (int argc, char *argv[]) +{ + long start_tv_sec, start_tv_usec; + long end_tv_sec, end_tv_usec; + int i; + DBusMessage *method; + DBusConnection *conn; + DBusError error; + + printf ("*** Testing pending call timeouts\n"); + + dbus_error_init (&error); + + conn = dbus_bus_get (DBUS_BUS_SESSION, &error); + + /* run 100 times to make sure */ + for (i = 0; i < 100; i++) + { + long delta; + + _dbus_get_current_time (&start_tv_sec, &start_tv_usec); + _run_iteration (conn); + _dbus_get_current_time (&end_tv_sec, &end_tv_usec); + + /* we just care about seconds */ + delta = end_tv_sec - start_tv_sec; + printf ("Iter %i: %lis\n", i, delta); + } + + method = dbus_message_new_method_call ("org.freedesktop.TestSuiteEchoService", + "/org/freedesktop/TestSuite", + "org.freedesktop.TestSuite", + "Exit"); + dbus_connection_send (conn, method, NULL); + dbus_message_unref (method); + + printf ("Success ***\n"); + exit (0); +} diff --git a/test/test-service.c b/test/test-service.c index bd2a4638..ee0086ca 100644 --- a/test/test-service.c +++ b/test/test-service.c @@ -1,5 +1,6 @@ #include "test-utils.h" +#include <unistd.h> static DBusLoop *loop; static dbus_bool_t already_quit = FALSE; @@ -223,6 +224,62 @@ handle_echo (DBusConnection *connection, return DBUS_HANDLER_RESULT_HANDLED; } +static DBusHandlerResult +handle_delay_echo (DBusConnection *connection, + DBusMessage *message) +{ + DBusError error; + DBusMessage *reply; + char *s; + + _dbus_verbose ("sleeping for a short time\n"); + + usleep (50000); + + _dbus_verbose ("sending reply to DelayEcho method\n"); + + dbus_error_init (&error); + + if (!dbus_message_get_args (message, + &error, + DBUS_TYPE_STRING, &s, + DBUS_TYPE_INVALID)) + { + reply = dbus_message_new_error (message, + error.name, + error.message); + + if (reply == NULL) + die ("No memory\n"); + + if (!dbus_connection_send (connection, reply, NULL)) + die ("No memory\n"); + + dbus_message_unref (reply); + + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + + reply = dbus_message_new_method_return (message); + if (reply == NULL) + die ("No memory\n"); + + if (!dbus_message_append_args (reply, + DBUS_TYPE_STRING, &s, + DBUS_TYPE_INVALID)) + die ("No memory"); + + if (!dbus_connection_send (connection, reply, NULL)) + die ("No memory\n"); + + fprintf (stderr, "DelayEcho service echoed string: \"%s\"\n", s); + + dbus_message_unref (reply); + + return DBUS_HANDLER_RESULT_HANDLED; +} + + static void path_unregistered_func (DBusConnection *connection, void *user_data) @@ -241,6 +298,10 @@ path_message_func (DBusConnection *connection, return handle_echo (connection, message); else if (dbus_message_is_method_call (message, "org.freedesktop.TestSuite", + "DelayEcho")) + return handle_delay_echo (connection, message); + else if (dbus_message_is_method_call (message, + "org.freedesktop.TestSuite", "Exit")) { quit (); diff --git a/tools/dbus-cleanup-sockets.c b/tools/dbus-cleanup-sockets.c index fd24fc0c..487c4b07 100644 --- a/tools/dbus-cleanup-sockets.c +++ b/tools/dbus-cleanup-sockets.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include <config.h> diff --git a/tools/dbus-launch-win.c b/tools/dbus-launch-win.c index 4d563191..cc936a6c 100644 --- a/tools/dbus-launch-win.c +++ b/tools/dbus-launch-win.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include <windows.h> diff --git a/tools/dbus-launch-x11.c b/tools/dbus-launch-x11.c index b1824181..56d7f744 100644 --- a/tools/dbus-launch-x11.c +++ b/tools/dbus-launch-x11.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-launch.h" diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c index 9c47d7e3..912afba8 100644 --- a/tools/dbus-launch.c +++ b/tools/dbus-launch.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-launch.h" diff --git a/tools/dbus-launch.h b/tools/dbus-launch.h index 74788793..d0d0617d 100644 --- a/tools/dbus-launch.h +++ b/tools/dbus-launch.h @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/tools/dbus-monitor.1 b/tools/dbus-monitor.1 index 5dea4ac8..c24c14d9 100644 --- a/tools/dbus-monitor.1 +++ b/tools/dbus-monitor.1 @@ -8,7 +8,7 @@ dbus-monitor \- debug probe to print message bus messages .SH SYNOPSIS .PP .B dbus-monitor -[\-\-system | \-\-session] [\-\-profile | \-\-monitor] +[\-\-system | \-\-session | \-\-address ADDRESS] [\-\-profile | \-\-monitor] [watch expressions] .SH DESCRIPTION @@ -37,7 +37,7 @@ and monitoring output format respectively. If neither is specified, .PP In order to get \fIdbus-monitor\fP to see the messages you are interested in, you should specify a set of watch expressions as you would expect to -be passed to the \fIdbus_bus_add_watch\fP function. +be passed to the \fIdbus_bus_add_match\fP function. .PP The message bus configuration may keep \fIdbus-monitor\fP from seeing @@ -51,6 +51,9 @@ Monitor the system message bus. .I "--session" Monitor the session message bus. (This is the default.) .TP +.I "--address ADDRESS" +Monitor an arbitrary message bus given at ADDRESS. +.TP .I "--profile" Use the profiling output format. .TP diff --git a/tools/dbus-monitor.c b/tools/dbus-monitor.c index cbd7a489..873108bc 100644 --- a/tools/dbus-monitor.c +++ b/tools/dbus-monitor.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -191,7 +191,7 @@ profile_filter_func (DBusConnection *connection, static void usage (char *name, int ecode) { - fprintf (stderr, "Usage: %s [--system | --session] [--monitor | --profile ] [watch expressions]\n", name); + fprintf (stderr, "Usage: %s [--system | --session | --address ADDRESS] [--monitor | --profile ] [watch expressions]\n", name); exit (ecode); } @@ -210,7 +210,8 @@ main (int argc, char *argv[]) DBusError error; DBusBusType type = DBUS_BUS_SESSION; DBusHandleMessageFunction filter_func = monitor_filter_func; - + char *address = NULL; + int i = 0, j = 0, numFilters = 0; char **filters = NULL; for (i = 1; i < argc; i++) @@ -221,6 +222,16 @@ main (int argc, char *argv[]) type = DBUS_BUS_SYSTEM; else if (!strcmp (arg, "--session")) type = DBUS_BUS_SESSION; + else if (!strcmp (arg, "--address")) + { + if (i+1 < argc) + { + address = argv[i+1]; + i++; + } + else + usage (argv[0], 1); + } else if (!strcmp (arg, "--help")) usage (argv[0], 0); else if (!strcmp (arg, "--monitor")) @@ -241,11 +252,44 @@ main (int argc, char *argv[]) } dbus_error_init (&error); - connection = dbus_bus_get (type, &error); + + if (address != NULL) + { + connection = dbus_connection_open (address, &error); + if (connection) + { + if (!dbus_bus_register (connection, &error)) + { + fprintf (stderr, "Failed to register connection to bus at %s: %s\n", + address, error.message); + dbus_error_free (&error); + exit (1); + } + } + } + else + connection = dbus_bus_get (type, &error); if (connection == NULL) { - fprintf (stderr, "Failed to open connection to %s message bus: %s\n", - (type == DBUS_BUS_SYSTEM) ? "system" : "session", + const char *where; + if (address != NULL) + where = address; + else + { + switch (type) + { + case DBUS_BUS_SYSTEM: + where = "system bus"; + break; + case DBUS_BUS_SESSION: + where = "session bus"; + break; + default: + where = ""; + } + } + fprintf (stderr, "Failed to open connection to %s: %s\n", + where, error.message); dbus_error_free (&error); exit (1); diff --git a/tools/dbus-print-message.c b/tools/dbus-print-message.c index ea15769f..335aa3dc 100644 --- a/tools/dbus-print-message.c +++ b/tools/dbus-print-message.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "dbus-print-message.h" diff --git a/tools/dbus-print-message.h b/tools/dbus-print-message.h index 2f9bf8ef..26700d84 100644 --- a/tools/dbus-print-message.h +++ b/tools/dbus-print-message.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_PRINT_MESSAGE_H diff --git a/tools/dbus-send.c b/tools/dbus-send.c index 81a9c372..c9c9be27 100644 --- a/tools/dbus-send.c +++ b/tools/dbus-send.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/tools/dbus-uuidgen.c b/tools/dbus-uuidgen.c index 6801dcea..c8ba1cf7 100644 --- a/tools/dbus-uuidgen.c +++ b/tools/dbus-uuidgen.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/tools/dbus-viewer.c b/tools/dbus-viewer.c index 3a550ac4..2fd28474 100644 --- a/tools/dbus-viewer.c +++ b/tools/dbus-viewer.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include <config.h> |