diff options
author | Simon McVittie <smcv@debian.org> | 2011-02-17 18:28:14 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2011-02-17 18:28:14 +0000 |
commit | 280851b7fdb7050e42403f57cbbbdbc368e59efa (patch) | |
tree | 1e0221b28d8a496eee7894c9776eeb84966168cb /tools | |
parent | 7e5f91a2e50af075be865533eb6ebdfe6bc5b4ad (diff) | |
download | dbus-280851b7fdb7050e42403f57cbbbdbc368e59efa.tar.gz |
Imported Upstream version 1.4.4upstream/1.4.4
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.in | 7 | ||||
-rw-r--r-- | tools/dbus-cleanup-sockets.c | 29 | ||||
-rw-r--r-- | tools/dbus-launch-x11.c | 19 | ||||
-rw-r--r-- | tools/lcov.am | 46 |
4 files changed, 84 insertions, 17 deletions
diff --git a/tools/Makefile.in b/tools/Makefile.in index 65bd1c91..1c1e8d5d 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -41,10 +41,11 @@ bin_PROGRAMS = dbus-launch$(EXEEXT) dbus-send$(EXEEXT) \ subdir = tools DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \ + $(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -229,6 +230,8 @@ EXPANDED_PREFIX = @EXPANDED_PREFIX@ EXPANDED_SYSCONFDIR = @EXPANDED_SYSCONFDIR@ FGREP = @FGREP@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ diff --git a/tools/dbus-cleanup-sockets.c b/tools/dbus-cleanup-sockets.c index 487c4b07..1b6709af 100644 --- a/tools/dbus-cleanup-sockets.c +++ b/tools/dbus-cleanup-sockets.c @@ -138,16 +138,31 @@ socket_entry_new (const char *dir, return se; } -#if 0 static void free_socket_entry (SocketEntry *se) { - free (se->name); - if (se->fd >= 0) - close (se->fd); - free (se); + if (se) + { + free (se->name); + if (se->fd >= 0) + close (se->fd); + free (se); + } +} + +static void +free_socket_entries (SocketEntry** entries, + int n_entries) +{ + int i; + + if (entries) + { + for (i = 0; i < n_entries; ++i) + free_socket_entry (entries[i]); + free (entries); + } } -#endif static void read_sockets (const char *dir, @@ -350,6 +365,8 @@ clean_dir (const char *dir) } unhandled_count += (n_entries - alive_count - cleaned_count); + + free_socket_entries (entries, n_entries); } #endif /* AF_UNIX */ diff --git a/tools/dbus-launch-x11.c b/tools/dbus-launch-x11.c index fe492227..0f344abe 100644 --- a/tools/dbus-launch-x11.c +++ b/tools/dbus-launch-x11.c @@ -293,6 +293,7 @@ init_x_atoms (Display *display) int x11_get_address (char **paddress, pid_t *pid, long *wid) { + int result; Atom type; Window owner; int format; @@ -310,10 +311,10 @@ x11_get_address (char **paddress, pid_t *pid, long *wid) *wid = (long) owner; /* get the bus address */ - XGetWindowProperty (xdisplay, owner, address_atom, 0, 1024, False, - XA_STRING, &type, &format, &items, &after, - (unsigned char **) &data); - if (type == None || after != 0 || data == NULL || format != 8) + result = XGetWindowProperty (xdisplay, owner, address_atom, 0, 1024, False, + XA_STRING, &type, &format, &items, &after, + (unsigned char **) &data); + if (result != Success || type == None || after != 0 || data == NULL || format != 8) return FALSE; /* error */ *paddress = xstrdup (data); @@ -323,10 +324,10 @@ x11_get_address (char **paddress, pid_t *pid, long *wid) if (pid != NULL) { *pid = 0; - XGetWindowProperty (xdisplay, owner, pid_atom, 0, sizeof pid, False, - XA_CARDINAL, &type, &format, &items, &after, - (unsigned char **) &data); - if (type != None && after == 0 && data != NULL && format == 32) + result = XGetWindowProperty (xdisplay, owner, pid_atom, 0, sizeof pid, False, + XA_CARDINAL, &type, &format, &items, &after, + (unsigned char **) &data); + if (result == Success && type != None && after == 0 && data != NULL && format == 32) *pid = (pid_t) *(long*) data; XFree (data); } @@ -404,6 +405,7 @@ set_address_in_file (char *address, pid_t pid, Window wid) return FALSE; f = fopen (session_file, "w"); + free (session_file); if (f == NULL) return FALSE; /* some kind of error */ fprintf (f, @@ -420,7 +422,6 @@ set_address_in_file (char *address, pid_t pid, Window wid) address, (long)pid, (long)wid); fclose (f); - free (session_file); return TRUE; } diff --git a/tools/lcov.am b/tools/lcov.am new file mode 100644 index 00000000..3178ba9f --- /dev/null +++ b/tools/lcov.am @@ -0,0 +1,46 @@ +# Copyright © 2008-2011 Collabora Ltd. +# Copyright © 2008-2011 Nokia Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +lcov-reset: + lcov --directory @abs_top_srcdir@ --zerocounters + +# gcov takes ~forever to process config-parser.c for some reason? +lcov-report: + true > bus/bus_test-config-parser.gcno + true > bus/dbus_daemon-config-parser.gcno + lcov --directory @abs_top_srcdir@ --capture \ + --output-file @abs_top_builddir@/lcov.info + $(mkdir_p) @abs_top_builddir@/lcov.html + git_commit=`GIT_DIR=@abs_top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`;\ + genhtml --title "@PACKAGE_STRING@ $$git_commit" \ + --output-directory @abs_top_builddir@/lcov.html lcov.info + @echo + @echo 'lcov report can be found in:' + @echo 'file://@abs_top_builddir@/lcov.html/index.html' + @echo + +lcov-check: + $(MAKE) lcov-reset + $(MAKE) check $(LCOV_CHECK_ARGS) + $(MAKE) lcov-report + +## vim:set ft=automake: |