--- libnih-1.0.3.orig/debian/control +++ libnih-1.0.3/debian/control @@ -0,0 +1,81 @@ +Source: libnih +Section: libs +Priority: required +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Scott James Remnant +Standards-Version: 3.9.4 +Build-Depends: debhelper (>= 9), pkg-config (>= 0.22), libdbus-1-dev (>= 1.4), libexpat1-dev (>= 2.0.0), dbus (>= 1.4), libc6-dev (>= 2.15~) | libc6.1-dev (>= 2.15~), + dh-autoreconf, autopoint, dpkg-dev (>= 1.16.1~) +# To cross build this package also needs: libdbus-1-dev:native (>= 1.4), libexpat1-dev:native (>= 2.0.0) +# But :native build-deps are not supported yet, so instead one can do +# $ apt-get build-dep libnih +# $ apt-get build-dep libnih -aarmhf +# instead to get all required build-deps +Vcs-Bzr: lp:ubuntu/libnih +XSC-Debian-Vcs-Git: git://git.debian.org/git/collab-maint/libnih.git +XSC-Debian-Vcs-Browser: http://git.debian.org/?p=collab-maint/libnih.git;a=summary +Homepage: https://launchpad.net/libnih + +Package: libnih1 +Architecture: any +Pre-Depends: ${misc:Pre-Depends}, ${shlibs:Depends}, ${misc:Depends} +Multi-Arch: same +Description: NIH Utility Library + libnih is a light-weight "standard library" of C functions to ease the + development of other libraries and applications, especially those + normally found in /lib. + . + This package contains the shared library. + +Package: libnih-dev +Priority: optional +Section: libdevel +Architecture: any +Multi-Arch: same +Depends: libnih1 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: NIH Utility Library (development files) + libnih is a light-weight "standard library" of C functions to ease the + development of other libraries and applications, especially those + normally found in /lib. + . + This package contains the static library and C header files which are + needed for developing software using libnih. + +Package: libnih-dbus1 +Architecture: any +Pre-Depends: ${misc:Pre-Depends} +Depends: libnih1 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Multi-Arch: same +Description: NIH D-Bus Bindings Library + libnih-dbus is a D-Bus bindings library that integrates with the main + loop provided by libnih. + . + This package contains the shared library. + +Package: libnih-dbus-dev +Priority: optional +Section: libdevel +Architecture: any +Multi-Arch: same +Depends: libnih-dbus1 (= ${binary:Version}), libnih-dev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Recommends: nih-dbus-tool (= ${binary:Version}) +Description: NIH D-Bus Bindings Library (development files) + libnih-dbus is a D-Bus bindings library that integrates with the main + loop provided by libnih. + . + This package contains the static library and C header files which are + needed for developing software using libnih-dbus. + +Package: nih-dbus-tool +Section: devel +Architecture: any +Multi-Arch: foreign +Depends: ${shlibs:Depends}, ${misc:Depends} +Recommends: libnih-dbus-dev (= ${binary:Version}) +Description: NIH D-Bus Binding Tool + nih-dbus-tool generates C source code from the D-Bus Introspection XML + data provided by most services; either to make implementing the + described objects in C programs or to make proxying to the described + remote objects easier. + . + The generated code requires libnih-dbus-dev to be compiled. --- libnih-1.0.3.orig/debian/libnih1.symbols +++ libnih-1.0.3/debian/libnih1.symbols @@ -0,0 +1,2 @@ +libnih.so.1 libnih1 #MINVER# + *@LIBNIH_1_0 1.0.0 --- libnih-1.0.3.orig/debian/libnih1.install +++ libnih-1.0.3/debian/libnih1.install @@ -0,0 +1 @@ +lib/*/libnih.so.* --- libnih-1.0.3.orig/debian/rules +++ libnih-1.0.3/debian/rules @@ -0,0 +1,54 @@ +#!/usr/bin/make -f + +include /usr/share/dpkg/architecture.mk + +%: + dh $@ --with autoreconf + + +CFLAGS := -Wall -fstack-protector -fPIE $(shell dpkg-buildflags --get CFLAGS) +LDFLAGS := -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -pie $(shell dpkg-buildflags --get LDFLAGS) + +override_dh_auto_configure: +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + dh_auto_configure -- CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ + --libdir=/lib/$(DEB_HOST_MULTIARCH) +else + dh_auto_configure -B build-dbus-tool/ -- CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ + --libdir=/lib/$(DEB_BUILD_MULTIARCH) \ + --host=$(DEB_BUILD_GNU_TYPE) + dh_auto_build -B build-dbus-tool/ --parallel + dh_auto_configure -- CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ + NIH_DBUS_TOOL=$(CURDIR)/build-dbus-tool/nih-dbus-tool/nih-dbus-tool \ + --libdir=/lib/$(DEB_HOST_MULTIARCH) +endif + +override_dh_auto_build: + dh_auto_build --parallel + +override_dh_auto_test: +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + dh_auto_test --parallel +endif + +override_dh_auto_install: + dh_auto_install -- pkgconfigdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)/pkgconfig + +override_dh_makeshlibs: + dh_makeshlibs -plibnih1 -V 'libnih1 (>= 1.0.0)' + dh_makeshlibs -plibnih-dbus1 -V 'libnih-dbus1 (>= 1.0.0)' + dh_makeshlibs -Nlibnih1 -Nlibnih-dbus1 + +override_dh_shlibdeps: + dh_shlibdeps + sed -i 's/2\.14/2.15/' debian/*.substvars + sed -i 's/>= 2.15)/>= 2.15~)/g' debian/*.substvars + + +# Symlink /usr/share/doc directories together +override_dh_installdocs: + dh_installdocs --link-doc=libnih1 + +override_dh_clean: + rm -rf build-dbus-tool/ + dh_clean --- libnih-1.0.3.orig/debian/changelog +++ libnih-1.0.3/debian/changelog @@ -0,0 +1,203 @@ +libnih (1.0.3-4ubuntu15) raring; urgency=low + + * Enable cross-building, sans adding :native build-dependencies. + See comments in debian/control. + * Lintian fixes. + + -- Dmitrijs Ledkovs Tue, 08 Jan 2013 15:38:58 +0000 + +libnih (1.0.3-4ubuntu14) raring; urgency=low + + * Update dbus code generator to allow for empty lists for type 'as'. + This drops the != NULL check for NULL terminated arrays and moves the + iteration loop inside an 'if' statement. + + -- Stéphane Graber Thu, 13 Dec 2012 10:00:27 -0500 + +libnih (1.0.3-4ubuntu13) raring; urgency=low + + [ Petr Lautrbach , Dmitrijs Ledkovs ] + * Fallback to lstat, if dirent.d_type is not available (not portable) + (LP: #672643) (Closes: #695604) + + -- Dmitrijs Ledkovs Tue, 11 Dec 2012 17:26:52 +0000 + +libnih (1.0.3-4ubuntu12) raring; urgency=low + + * nih/logging.c: Use our own __nih_abort_msg rather than the (e)glibc + private symbol __abort_msg to avoid upgrade issues (LP: #997359). + * nih/tests/test_logging.c: Update tests for __nih_abort_msg. + + -- James Hunt Thu, 25 Oct 2012 10:57:30 +0100 + +libnih (1.0.3-4ubuntu11) quantal; urgency=low + + * Addition of debian/libnih-dbus1.postinst and + debian/libnih1.postinst to force Upstart re-exec on shutdown + to avoid unmounting disks uncleanly (LP: #740390). + + -- James Hunt Wed, 03 Oct 2012 16:49:40 +0100 + +libnih (1.0.3-4ubuntu10) quantal; urgency=low + + * Update config.guess,sub for aarch64 + + -- Wookey Mon, 01 Oct 2012 12:57:05 +0100 + +libnih (1.0.3-4ubuntu9) precise; urgency=low + + * Mark the nih-dbus-tool package Multi-Arch: foreign so it can be used as + a build-dependency of upstart when cross-building. + + -- Steve Langasek Wed, 15 Feb 2012 22:57:50 -0800 + +libnih (1.0.3-4ubuntu8) precise; urgency=low + + * libnih1 needs a versioned Pre-Depend on libc6 instead of just a Depend, + because libc6 itself uses runlevel from the upstart package in its + preinst, which in turn uses libnih1, which needs to be loadable (i.e., + its symbol references resolve). We therefore need to ensure that + libnih1's dependencies are always unpacked before libnih1 itself is + unpacked. While having something further up the stack (such as upstart, + or something on top of upstart) being marked Essential: yes and with the + necessary pre-depends would let apt handle this for us with its + "immediate configuration" support, but for various reasons we don't want + to make upstart essential. LP: #508083. + + -- Steve Langasek Fri, 10 Feb 2012 12:13:25 -0800 + +libnih (1.0.3-4ubuntu7) precise; urgency=low + + * Relax dependency on libc6. + + -- Matthias Klose Wed, 08 Feb 2012 23:43:21 +0100 + +libnih (1.0.3-4ubuntu6) precise; urgency=low + + * Rebuild with libc6-dev (>= 2.15~). + + -- Matthias Klose Wed, 08 Feb 2012 21:48:57 +0100 + +libnih (1.0.3-4ubuntu5) precise; urgency=low + + * Mark libnih-dev and libnih-dbus-dev Multi-Arch: same as well. + + -- Steve Langasek Sun, 06 Nov 2011 14:45:07 -0800 + +libnih (1.0.3-4ubuntu4) precise; urgency=low + + * Make libnih1 and libnih-dbus1 installable using multi-arch. + + -- James Hunt Tue, 01 Nov 2011 14:25:09 -0400 + +libnih (1.0.3-4ubuntu3) precise; urgency=low + + * Build to install with eglibc-2.15. + + -- Matthias Klose Fri, 14 Oct 2011 14:05:03 +0200 + +libnih (1.0.3-4ubuntu2) oneiric; urgency=low + + * Use dpkg-buildflags to get the build flags. + * Build with the default build flags, don't hard-code -Os. LP: #791315. + + -- Matthias Klose Wed, 15 Jun 2011 16:45:42 +0200 + +libnih (1.0.3-4ubuntu1) oneiric; urgency=low + + * Merge from debian unstable. Retained Ubuntu Build-Depends and Priority. + + -- James Hunt Mon, 23 May 2011 19:28:19 +0100 + +libnih (1.0.3-1ubuntu1) natty; urgency=low + + * Rebuild with libc6-dev (>= 2.13~). + + -- Matthias Klose Fri, 18 Feb 2011 12:09:29 +0100 + +libnih (1.0.3-1) natty; urgency=low + + * New upstream release: + - Added support for passing file descriptors over D-Bus to nih-dbus-tool + + -- Scott James Remnant Thu, 23 Dec 2010 22:28:24 +0000 + +libnih (1.0.2-2) natty; urgency=low + + * Revert the previous upload. It is never acceptable to simply disable + tests, especially when it turns out that the test that was disabled + was failing because there was a serious bug that could cause kernel + panics for people on boot. + + Test suites are here for a reason. + + * Bumped libdbus Build-Dependency to the version with the bug fix that + caused the test suite to fail. + + -- Scott James Remnant Wed, 08 Dec 2010 19:40:15 +0000 + +libnih (1.0.2-1ubuntu3) natty; urgency=low + + * Disable some tests on ppc64 to build an initial package. + + -- Matthias Klose Thu, 18 Nov 2010 10:59:38 +0100 + +libnih (1.0.2-1ubuntu2) maverick; urgency=low + + * Re-add -fPIE to the testsuite on armel, removing all armel-specific tests; + current gcc-4.4 don't seem affected by the ICE anymore (see LP #398403). + + -- Loïc Minier Mon, 23 Aug 2010 10:25:31 +0200 + +libnih (1.0.2-1ubuntu1) maverick; urgency=low + + * Rebuild with libc6-dev (>= 2.12~), after checking that + __abort_msg is available with the same signature in eglibc 2.12. + * Don't build the testsuite with -fPIE on armel; LP: #398403. + + -- Matthias Klose Sun, 30 May 2010 02:54:56 +0200 + +libnih (1.0.2-1) maverick; urgency=low + + * New upstream release: + - Rename AC_COPYRIGHT to NIH_COPYRIGHT to avoid conflict with other + packages. + - Add serial to libnih.m4 + - Add NIH_WITH_LOCAL_LIBNIH macro. + + * Fix use of ${Source-Version} to be ${binary:Version} + * Add debian/source/format with "1.0" to be future compatible. + * Bump standards version. + + -- Scott James Remnant Tue, 27 Apr 2010 10:49:55 -0700 + +libnih (1.0.1-1) lucid; urgency=low + + * New upstream release: + - Add missing __nih_* symbols to linker version script so that we + can link Upstart's test suite. + - Glibc __abort_msg symbol now only linked as a weak symbol. + + -- Scott James Remnant Thu, 04 Feb 2010 14:53:26 -0800 + +libnih (1.0.0-2build1) lucid; urgency=low + + * Rebuild to pick up relaxed dependency on libc6, after checking that + __abort_msg is available with the same signature in eglibc 2.11. + LP: #508702. + + -- Matthias Klose Mon, 18 Jan 2010 16:09:13 +0100 + +libnih (1.0.0-2) lucid; urgency=low + + * debian/control: Add build-dependency on dbus so the test suite can + pass on the buildds. + + -- Scott James Remnant Sat, 28 Nov 2009 23:28:27 +0000 + +libnih (1.0.0-1) lucid; urgency=low + + * First upstream release. Previously this code was included in the + upstart, mountall and ureadahead source packages. + + -- Scott James Remnant Sat, 28 Nov 2009 21:14:00 +0000 --- libnih-1.0.3.orig/debian/libnih1.postinst +++ libnih-1.0.3/debian/libnih1.postinst @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +if [ "$1" = configure ]; then + # Before we shutdown or reboot, upstart needs to re-exec + # so that it can safely unmount the root filesystem (LP: #740390) + touch /var/run/init.upgraded || : +fi + +#DEBHELPER# --- libnih-1.0.3.orig/debian/libnih-dbus1.install +++ libnih-1.0.3/debian/libnih-dbus1.install @@ -0,0 +1 @@ +lib/*/libnih-dbus.so.* --- libnih-1.0.3.orig/debian/libnih-dbus1.postinst +++ libnih-1.0.3/debian/libnih-dbus1.postinst @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +if [ "$1" = configure ]; then + # Before we shutdown or reboot, upstart needs to re-exec + # so that it can safely unmount the root filesystem (LP: #740390) + touch /var/run/init.upgraded || : +fi + +#DEBHELPER# --- libnih-1.0.3.orig/debian/compat +++ libnih-1.0.3/debian/compat @@ -0,0 +1 @@ +9 --- libnih-1.0.3.orig/debian/libnih-dev.install +++ libnih-1.0.3/debian/libnih-dev.install @@ -0,0 +1,6 @@ +lib/*/libnih.a +lib/*/libnih.so +usr/include/libnih.h +usr/include/nih +usr/lib/*/pkgconfig/libnih.pc +usr/share/aclocal/libnih.m4 --- libnih-1.0.3.orig/debian/libnih-dbus1.symbols +++ libnih-1.0.3/debian/libnih-dbus1.symbols @@ -0,0 +1,2 @@ +libnih-dbus.so.1 libnih-dbus1 #MINVER# + *@LIBNIH_DBUS_1_0 1.0.0 --- libnih-1.0.3.orig/debian/libnih1.docs +++ libnih-1.0.3/debian/libnih1.docs @@ -0,0 +1,3 @@ +AUTHORS +NEWS +README --- libnih-1.0.3.orig/debian/nih-dbus-tool.install +++ libnih-1.0.3/debian/nih-dbus-tool.install @@ -0,0 +1,2 @@ +usr/bin/nih-dbus-tool +usr/share/man/man1/nih-dbus-tool.1 --- libnih-1.0.3.orig/debian/changelog.DEBIAN +++ libnih-1.0.3/debian/changelog.DEBIAN @@ -0,0 +1,118 @@ +libnih (1.0.3-4) unstable; urgency=low + + * Rebuild for new libc to update versioned dependency; this comes from + the __abort_msg dependency, dpkg-shlibs needs overriding since this is + actually a weak link, but this rebuild fixes things for now. + Closes: #625257. + + -- Scott James Remnant Mon, 02 May 2011 15:08:33 -0700 + +libnih (1.0.3-3) unstable; urgency=low + + * New maintainer. Closes: #624442. + + -- Scott James Remnant Thu, 28 Apr 2011 14:26:05 -0700 + +libnih (1.0.3-2) unstable; urgency=low + + * Bump build dependency on libdbus-1-dev and dbus to (>= 1.4) for Unix file + descriptor passing support. + + -- Michael Biebl Thu, 10 Feb 2011 20:25:18 +0100 + +libnih (1.0.3-1ubuntu1) natty; urgency=low + + * Rebuild with libc6-dev (>= 2.13~). + + -- Matthias Klose Fri, 18 Feb 2011 12:09:29 +0100 + +libnih (1.0.3-1) unstable; urgency=low + + * New upstream release. + * Bump debhelper compatibility level to 8 and update build dependency + accordingly. + + -- Michael Biebl Mon, 07 Feb 2011 22:19:13 +0100 + +libnih (1.0.2-2) unstable; urgency=low + + * Install library development files to /usr/lib and not /lib. + * Remove libtool *.la files as there are no reverse dependencies referencing + them. + * Bump Standards-Version to 3.9.1. No further changes. + + -- Michael Biebl Sun, 02 Jan 2011 21:09:40 +0100 + +libnih (1.0.2-1ubuntu3) natty; urgency=low + + * Disable some tests on ppc64 to build an initial package. + + -- Matthias Klose Thu, 18 Nov 2010 10:59:38 +0100 + +libnih (1.0.2-1ubuntu2) maverick; urgency=low + + * Re-add -fPIE to the testsuite on armel, removing all armel-specific tests; + current gcc-4.4 don't seem affected by the ICE anymore (see LP #398403). + + -- Loïc Minier Mon, 23 Aug 2010 10:25:31 +0200 + +libnih (1.0.2-1ubuntu1) maverick; urgency=low + + * Rebuild with libc6-dev (>= 2.12~), after checking that + __abort_msg is available with the same signature in eglibc 2.12. + * Don't build the testsuite with -fPIE on armel; LP: #398403. + + -- Matthias Klose Sun, 30 May 2010 02:54:56 +0200 + +libnih (1.0.2-1) unstable; urgency=low + + * Initial upload to Debian. Closes: #585071 + * Based on the Ubuntu package for Lucid done by Scott James Remnant with the + following changes: + - Switch packages to priority optional. + - Use binary:Version instead of Source-Version. + - Bump Standards-Version to 3.8.4. + - Add Homepage and Vcs-* fields. + - Don't symlink /usr/share/doc directories. + - Refer to versioned /usr/share/common-licenses/GPL-2 file in + debian/copyright. + - List all symbols explicitly instead of using a wildcard and add symbols + introduced in 1.0.1. + - Use the symbols files to create the correct version info instead of + specifying it manually via shlibs. + - Switch to source format 3.0 (quilt). + - Add watch file to track new upstream releases. + + -- Michael Biebl Sun, 13 Jun 2010 23:36:52 +0200 + +libnih (1.0.1-1) lucid; urgency=low + + * New upstream release: + - Add missing __nih_* symbols to linker version script so that we + can link Upstart's test suite. + - Glibc __abort_msg symbol now only linked as a weak symbol. + + -- Scott James Remnant Thu, 04 Feb 2010 14:53:26 -0800 + +libnih (1.0.0-2build1) lucid; urgency=low + + * Rebuild to pick up relaxed dependency on libc6, after checking that + __abort_msg is available with the same signature in eglibc 2.11. + LP: #508702. + + -- Matthias Klose Mon, 18 Jan 2010 16:09:13 +0100 + +libnih (1.0.0-2) lucid; urgency=low + + * debian/control: Add build-dependency on dbus so the test suite can + pass on the buildds. + + -- Scott James Remnant Sat, 28 Nov 2009 23:28:27 +0000 + +libnih (1.0.0-1) lucid; urgency=low + + * First upstream release. Previously this code was included in the + upstart, mountall and ureadahead source packages. + + -- Scott James Remnant Sat, 28 Nov 2009 21:14:00 +0000 + --- libnih-1.0.3.orig/debian/copyright +++ libnih-1.0.3/debian/copyright @@ -0,0 +1,18 @@ +This is the Ubuntu package of libnih, the NIH Utility Library. + +Copyright © 2009 Canonical Ltd. +Copyright © 2009 Scott James Remnant + +Licence: + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 2, as +published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +On Ubuntu systems, the complete text of the GNU General Public License +can be found in ‘/usr/share/common-licenses/GPL-2’. --- libnih-1.0.3.orig/debian/libnih-dbus-dev.install +++ libnih-1.0.3/debian/libnih-dbus-dev.install @@ -0,0 +1,5 @@ +lib/*/libnih-dbus.a +lib/*/libnih-dbus.so +usr/include/libnih-dbus.h +usr/include/nih-dbus +usr/lib/*/pkgconfig/libnih-dbus.pc --- libnih-1.0.3.orig/debian/source/format +++ libnih-1.0.3/debian/source/format @@ -0,0 +1 @@ +1.0 --- libnih-1.0.3.orig/nih-dbus-tool/marshal.c +++ libnih-1.0.3/nih-dbus-tool/marshal.c @@ -364,6 +364,7 @@ nih_local TypeVar *element_len_var = NULL; nih_local char * block = NULL; nih_local char * vars_block = NULL; + nih_local char * loop_block = NULL; nih_assert (iter != NULL); nih_assert (iter_name != NULL); @@ -448,7 +449,7 @@ nih_list_add (locals, &array_iter_var->entry); if (dbus_type_is_fixed (element_type)) { - if (! nih_strcat_sprintf (&code, parent, + if (! nih_strcat_sprintf (&loop_block, parent, "for (size_t %s = 0; %s < %s; %s++) {\n", loop_name, loop_name, len_name, loop_name)) { nih_free (code); @@ -456,6 +457,12 @@ } } else { if (! nih_strcat_sprintf (&code, parent, + "if (%s) {\n", + name)) { + nih_free (code); + return NULL; + } + if (! nih_strcat_sprintf (&loop_block, parent, "for (size_t %s = 0; %s[%s]; %s++) {\n", loop_name, name, loop_name, loop_name)) { nih_free (code); @@ -576,7 +583,7 @@ } - if (! nih_strcat_sprintf (&code, parent, + if (! nih_strcat_sprintf (&loop_block, parent, "%s" "\n" "%s" @@ -590,9 +597,34 @@ } /* Close the container again */ + if (! nih_strcat_sprintf (&loop_block, parent, + "}\n")) { + nih_free (code); + return NULL; + } + + if (dbus_type_is_fixed (element_type)) { + if (! nih_strcat_sprintf (&code, parent, + "%s\n", loop_block)) { + nih_free (code); + return NULL; + } + } + else { + if (! indent (&loop_block, NULL, 1)) { + nih_free (code); + return NULL; + } + + if (! nih_strcat_sprintf (&code, parent, + "%s" + "}\n\n", loop_block)) { + nih_free (code); + return NULL; + } + } + if (! nih_strcat_sprintf (&code, parent, - "}\n" - "\n" "if (! dbus_message_iter_close_container (&%s, &%s)) {\n" "%s" "}\n", --- libnih-1.0.3.orig/nih-dbus-tool/type.c +++ libnih-1.0.3/nih-dbus-tool/type.c @@ -1101,7 +1101,7 @@ nih_assert (block != NULL); nih_assert (var != NULL); - if (! strchr (var->type, '*')) + if (! strchr (var->type, '*') || ! strcmp (var->type, "char * const *")) return *block; if (next && (! strcmp (next->type, "size_t"))) { --- libnih-1.0.3.orig/nih-dbus-tool/tests/test_marshal.c +++ libnih-1.0.3/nih-dbus-tool/tests/test_marshal.c @@ -1479,39 +1479,41 @@ "\treturn -1;\n" "}\n" "\n" - "for (size_t value_i = 0; value[value_i]; value_i++) {\n" - "\tDBusMessageIter value_element_iter;\n" - "\tconst int16_t * value_element;\n" - "\tsize_t value_element_len;\n" + "if (value) {\n" + "\tfor (size_t value_i = 0; value[value_i]; value_i++) {\n" + "\t\tDBusMessageIter value_element_iter;\n" + "\t\tconst int16_t * value_element;\n" + "\t\tsize_t value_element_len;\n" "\n" - "\tvalue_element = value[value_i];\n" - "\tvalue_element_len = value_len[value_i];\n" + "\t\tvalue_element = value[value_i];\n" + "\t\tvalue_element_len = value_len[value_i];\n" "\n" - "\t/* Marshal an array onto the message */\n" - "\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_ARRAY, \"n\", &value_element_iter)) {\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" - "\t}\n" + "\t\t/* Marshal an array onto the message */\n" + "\t\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_ARRAY, \"n\", &value_element_iter)) {\n" + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\treturn -1;\n" + "\t\t}\n" "\n" - "\tfor (size_t value_element_i = 0; value_element_i < value_element_len; value_element_i++) {\n" - "\t\tint16_t value_element_element;\n" + "\t\tfor (size_t value_element_i = 0; value_element_i < value_element_len; value_element_i++) {\n" + "\t\t\tint16_t value_element_element;\n" "\n" - "\t\tvalue_element_element = value_element[value_element_i];\n" + "\t\t\tvalue_element_element = value_element[value_element_i];\n" "\n" - "\t\t/* Marshal a int16_t onto the message */\n" - "\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_INT16, &value_element_element)) {\n" - "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" + "\t\t\t/* Marshal a int16_t onto the message */\n" + "\t\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_INT16, &value_element_element)) {\n" + "\t\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" + "\t\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\t\treturn -1;\n" + "\t\t\t}\n" + "\t\t}\n" + "\n" + "\t\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" "\t\t\treturn -1;\n" "\t\t}\n" - "\t}\n" - "\n" - "\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" - "\t}\n" + "\t}\n" "}\n" "\n" "if (! dbus_message_iter_close_container (&iter, &value_iter)) {\n" @@ -1766,15 +1768,17 @@ "\treturn -1;\n" "}\n" "\n" - "for (size_t value_i = 0; value[value_i]; value_i++) {\n" - "\tconst char *value_element;\n" + "if (value) {\n" + "\tfor (size_t value_i = 0; value[value_i]; value_i++) {\n" + "\t\tconst char *value_element;\n" "\n" - "\tvalue_element = value[value_i];\n" + "\t\tvalue_element = value[value_i];\n" "\n" - "\t/* Marshal a char * onto the message */\n" - "\tif (! dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_STRING, &value_element)) {\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" + "\t\t/* Marshal a char * onto the message */\n" + "\t\tif (! dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_STRING, &value_element)) {\n" + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\treturn -1;\n" + "\t\t}\n" "\t}\n" "}\n" "\n" @@ -1933,35 +1937,39 @@ "\treturn -1;\n" "}\n" "\n" - "for (size_t value_i = 0; value[value_i]; value_i++) {\n" - "\tDBusMessageIter value_element_iter;\n" - "\tchar * const * value_element;\n" + "if (value) {\n" + "\tfor (size_t value_i = 0; value[value_i]; value_i++) {\n" + "\t\tDBusMessageIter value_element_iter;\n" + "\t\tchar * const * value_element;\n" "\n" - "\tvalue_element = value[value_i];\n" + "\t\tvalue_element = value[value_i];\n" "\n" - "\t/* Marshal an array onto the message */\n" - "\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_ARRAY, \"s\", &value_element_iter)) {\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" - "\t}\n" - "\n" - "\tfor (size_t value_element_i = 0; value_element[value_element_i]; value_element_i++) {\n" - "\t\tconst char *value_element_element;\n" + "\t\t/* Marshal an array onto the message */\n" + "\t\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_ARRAY, \"s\", &value_element_iter)) {\n" + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\treturn -1;\n" + "\t\t}\n" "\n" - "\t\tvalue_element_element = value_element[value_element_i];\n" + "\t\tif (value_element) {\n" + "\t\t\tfor (size_t value_element_i = 0; value_element[value_element_i]; value_element_i++) {\n" + "\t\t\t\tconst char *value_element_element;\n" + "\n" + "\t\t\t\tvalue_element_element = value_element[value_element_i];\n" + "\n" + "\t\t\t\t/* Marshal a char * onto the message */\n" + "\t\t\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_STRING, &value_element_element)) {\n" + "\t\t\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" + "\t\t\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\t\t\treturn -1;\n" + "\t\t\t\t}\n" + "\t\t\t}\n" + "\t\t}\n" "\n" - "\t\t/* Marshal a char * onto the message */\n" - "\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_STRING, &value_element_element)) {\n" - "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" + "\t\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" "\t\t\treturn -1;\n" "\t\t}\n" "\t}\n" - "\n" - "\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" - "\t}\n" "}\n" "\n" "if (! dbus_message_iter_close_container (&iter, &value_iter)) {\n" @@ -2194,16 +2202,18 @@ "\treturn -1;\n" "}\n" "\n" - "for (size_t value_item2_i = 0; value_item2[value_item2_i]; value_item2_i++) {\n" - "\tconst char *value_item2_element;\n" + "if (value_item2) {\n" + "\tfor (size_t value_item2_i = 0; value_item2[value_item2_i]; value_item2_i++) {\n" + "\t\tconst char *value_item2_element;\n" "\n" - "\tvalue_item2_element = value_item2[value_item2_i];\n" + "\t\tvalue_item2_element = value_item2[value_item2_i];\n" "\n" - "\t/* Marshal a char * onto the message */\n" - "\tif (! dbus_message_iter_append_basic (&value_item2_iter, DBUS_TYPE_STRING, &value_item2_element)) {\n" - "\t\tdbus_message_iter_abandon_container (&value_iter, &value_item2_iter);\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" + "\t\t/* Marshal a char * onto the message */\n" + "\t\tif (! dbus_message_iter_append_basic (&value_item2_iter, DBUS_TYPE_STRING, &value_item2_element)) {\n" + "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_item2_iter);\n" + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\treturn -1;\n" + "\t\t}\n" "\t}\n" "}\n" "\n" @@ -2642,41 +2652,43 @@ "\treturn -1;\n" "}\n" "\n" - "for (size_t value_i = 0; value[value_i]; value_i++) {\n" - "\tDBusMessageIter value_element_iter;\n" - "\tconst char * value_element_item0;\n" - "\tuint32_t value_element_item1;\n" - "\tconst MyStructArrayValueElement *value_element;\n" + "if (value) {\n" + "\tfor (size_t value_i = 0; value[value_i]; value_i++) {\n" + "\t\tDBusMessageIter value_element_iter;\n" + "\t\tconst char * value_element_item0;\n" + "\t\tuint32_t value_element_item1;\n" + "\t\tconst MyStructArrayValueElement *value_element;\n" "\n" - "\tvalue_element = value[value_i];\n" + "\t\tvalue_element = value[value_i];\n" "\n" - "\t/* Marshal a structure onto the message */\n" - "\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_STRUCT, NULL, &value_element_iter)) {\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" - "\t}\n" + "\t\t/* Marshal a structure onto the message */\n" + "\t\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_STRUCT, NULL, &value_element_iter)) {\n" + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\treturn -1;\n" + "\t\t}\n" "\n" - "\tvalue_element_item0 = value_element->item0;\n" + "\t\tvalue_element_item0 = value_element->item0;\n" "\n" - "\t/* Marshal a char * onto the message */\n" - "\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_STRING, &value_element_item0)) {\n" - "\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" - "\t}\n" + "\t\t/* Marshal a char * onto the message */\n" + "\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_STRING, &value_element_item0)) {\n" + "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\treturn -1;\n" + "\t\t}\n" "\n" - "\tvalue_element_item1 = value_element->item1;\n" + "\t\tvalue_element_item1 = value_element->item1;\n" "\n" - "\t/* Marshal a uint32_t onto the message */\n" - "\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_UINT32, &value_element_item1)) {\n" - "\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" - "\t}\n" + "\t\t/* Marshal a uint32_t onto the message */\n" + "\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_UINT32, &value_element_item1)) {\n" + "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\treturn -1;\n" + "\t\t}\n" "\n" - "\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" + "\t\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\treturn -1;\n" + "\t\t}\n" "\t}\n" "}\n" "\n" @@ -2912,41 +2924,43 @@ "\treturn -1;\n" "}\n" "\n" - "for (size_t value_i = 0; value[value_i]; value_i++) {\n" - "\tDBusMessageIter value_element_iter;\n" - "\tconst char * value_element_item0;\n" - "\tuint32_t value_element_item1;\n" - "\tconst MyDictEntryArrayValueElement *value_element;\n" + "if (value) {\n" + "\tfor (size_t value_i = 0; value[value_i]; value_i++) {\n" + "\t\tDBusMessageIter value_element_iter;\n" + "\t\tconst char * value_element_item0;\n" + "\t\tuint32_t value_element_item1;\n" + "\t\tconst MyDictEntryArrayValueElement *value_element;\n" "\n" - "\tvalue_element = value[value_i];\n" + "\t\tvalue_element = value[value_i];\n" "\n" - "\t/* Marshal a structure onto the message */\n" - "\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_DICT_ENTRY, NULL, &value_element_iter)) {\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" - "\t}\n" + "\t\t/* Marshal a structure onto the message */\n" + "\t\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_DICT_ENTRY, NULL, &value_element_iter)) {\n" + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\treturn -1;\n" + "\t\t}\n" "\n" - "\tvalue_element_item0 = value_element->item0;\n" + "\t\tvalue_element_item0 = value_element->item0;\n" "\n" - "\t/* Marshal a char * onto the message */\n" - "\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_STRING, &value_element_item0)) {\n" - "\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" - "\t}\n" + "\t\t/* Marshal a char * onto the message */\n" + "\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_STRING, &value_element_item0)) {\n" + "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\treturn -1;\n" + "\t\t}\n" "\n" - "\tvalue_element_item1 = value_element->item1;\n" + "\t\tvalue_element_item1 = value_element->item1;\n" "\n" - "\t/* Marshal a uint32_t onto the message */\n" - "\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_UINT32, &value_element_item1)) {\n" - "\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" - "\t}\n" + "\t\t/* Marshal a uint32_t onto the message */\n" + "\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_UINT32, &value_element_item1)) {\n" + "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\treturn -1;\n" + "\t\t}\n" "\n" - "\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" - "\t\treturn -1;\n" + "\t\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" + "\t\t\treturn -1;\n" + "\t\t}\n" "\t}\n" "}\n" "\n" --- libnih-1.0.3.orig/nih-dbus-tool/tests/expected/test_method_object_function_no_input.c +++ libnih-1.0.3/nih-dbus-tool/tests/expected/test_method_object_function_no_input.c @@ -88,17 +88,19 @@ goto enomem; } - for (size_t output_i = 0; output[output_i]; output_i++) { - const char *output_element; + if (output) { + for (size_t output_i = 0; output[output_i]; output_i++) { + const char *output_element; - output_element = output[output_i]; + output_element = output[output_i]; - /* Marshal a char * onto the message */ - if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { - dbus_message_iter_abandon_container (&iter, &output_iter); - dbus_message_unref (reply); - reply = NULL; - goto enomem; + /* Marshal a char * onto the message */ + if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { + dbus_message_iter_abandon_container (&iter, &output_iter); + dbus_message_unref (reply); + reply = NULL; + goto enomem; + } } } --- libnih-1.0.3.orig/nih-dbus-tool/tests/expected/test_method_object_function_standard.c +++ libnih-1.0.3/nih-dbus-tool/tests/expected/test_method_object_function_standard.c @@ -136,17 +136,19 @@ goto enomem; } - for (size_t output_i = 0; output[output_i]; output_i++) { - const char *output_element; + if (output) { + for (size_t output_i = 0; output[output_i]; output_i++) { + const char *output_element; - output_element = output[output_i]; + output_element = output[output_i]; - /* Marshal a char * onto the message */ - if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { - dbus_message_iter_abandon_container (&iter, &output_iter); - dbus_message_unref (reply); - reply = NULL; - goto enomem; + /* Marshal a char * onto the message */ + if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { + dbus_message_iter_abandon_container (&iter, &output_iter); + dbus_message_unref (reply); + reply = NULL; + goto enomem; + } } } --- libnih-1.0.3.orig/nih-dbus-tool/tests/expected/test_method_reply_function_standard.c +++ libnih-1.0.3/nih-dbus-tool/tests/expected/test_method_reply_function_standard.c @@ -7,7 +7,6 @@ DBusMessageIter output_iter; nih_assert (message != NULL); - nih_assert (output != NULL); /* If the sender doesn't care about a reply, don't bother wasting * effort constructing and sending one. @@ -28,16 +27,18 @@ return -1; } - for (size_t output_i = 0; output[output_i]; output_i++) { - const char *output_element; - - output_element = output[output_i]; - - /* Marshal a char * onto the message */ - if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { - dbus_message_iter_abandon_container (&iter, &output_iter); - dbus_message_unref (reply); - return -1; + if (output) { + for (size_t output_i = 0; output[output_i]; output_i++) { + const char *output_element; + + output_element = output[output_i]; + + /* Marshal a char * onto the message */ + if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { + dbus_message_iter_abandon_container (&iter, &output_iter); + dbus_message_unref (reply); + return -1; + } } } --- libnih-1.0.3.orig/nih-dbus-tool/tests/expected/test_method_reply_function_deprecated.c +++ libnih-1.0.3/nih-dbus-tool/tests/expected/test_method_reply_function_deprecated.c @@ -7,7 +7,6 @@ DBusMessageIter output_iter; nih_assert (message != NULL); - nih_assert (output != NULL); /* If the sender doesn't care about a reply, don't bother wasting * effort constructing and sending one. @@ -28,16 +27,18 @@ return -1; } - for (size_t output_i = 0; output[output_i]; output_i++) { - const char *output_element; - - output_element = output[output_i]; - - /* Marshal a char * onto the message */ - if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { - dbus_message_iter_abandon_container (&iter, &output_iter); - dbus_message_unref (reply); - return -1; + if (output) { + for (size_t output_i = 0; output[output_i]; output_i++) { + const char *output_element; + + output_element = output[output_i]; + + /* Marshal a char * onto the message */ + if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { + dbus_message_iter_abandon_container (&iter, &output_iter); + dbus_message_unref (reply); + return -1; + } } } --- libnih-1.0.3.orig/nih/logging.c +++ libnih-1.0.3/nih/logging.c @@ -39,11 +39,11 @@ /** - * __abort_msg: + * __nih_abort_msg: * - * A glibc variable that keeps the assertion message in the core dump. + * A variable that keeps the assertion message in the core dump. **/ -extern char *__abort_msg __attribute__ ((weak)); +char *__nih_abort_msg; /** * logger: @@ -114,19 +114,19 @@ * nih_log_abort_message: * @message: message to be logged. * - * Save @message in the glibc __abort_msg variable so it can be retrieved + * Save @message in the __nih_abort_msg variable so it can be retrieved * by debuggers if we should crash at this point. **/ static void nih_log_abort_message (const char *message) { - if (! &__abort_msg) + if (! &__nih_abort_msg) return; - if (__abort_msg) - nih_discard (__abort_msg); + if (__nih_abort_msg) + nih_discard (__nih_abort_msg); - __abort_msg = NIH_MUST (nih_strdup (NULL, message)); + __nih_abort_msg = NIH_MUST (nih_strdup (NULL, message)); } /** --- libnih-1.0.3.orig/nih/file.c +++ libnih-1.0.3/nih/file.c @@ -619,6 +619,8 @@ struct dirent *ent; char **paths; size_t npaths; + int isdir; + struct stat statbuf; nih_assert (path != NULL); @@ -640,7 +642,15 @@ subpath = NIH_MUST (nih_sprintf (NULL, "%s/%s", path, ent->d_name)); - if (filter && filter (data, subpath, ent->d_type == DT_DIR)) + if (ent->d_type == DT_UNKNOWN) { + if ( lstat (subpath, &statbuf)) + isdir = 0; + else + isdir = S_ISDIR(statbuf.st_mode); + } else + isdir = ent->d_type == DT_DIR; + + if (filter && filter (data, subpath, isdir)) continue; NIH_MUST (nih_str_array_addp (&paths, NULL, &npaths, subpath)); --- libnih-1.0.3.orig/nih/tests/test_file.c +++ libnih-1.0.3/nih/tests/test_file.c @@ -724,6 +724,25 @@ return FALSE; } +/* find only frodo files */ +static int +my_filter_frodo_file (void *data, + const char *path, + int is_dir) +{ + char *slash; + + if (is_dir) + return FALSE; + + slash = strrchr (path, '/'); + if (strcmp (slash, "/frodo")) + return TRUE; + + return FALSE; +} + + static int logger_called = 0; static int @@ -905,6 +924,48 @@ TEST_EQ_STR (v->path, filename); nih_free (visited); + + /* Try also inverse filter */ + TEST_ALLOC_SAFE { + visitor_called = 0; + visited = nih_list_new (NULL); + } + + ret = nih_dir_walk (dirname, my_filter_frodo_file, + my_visitor, NULL, &ret); + + TEST_EQ (ret, 0); + TEST_EQ (visitor_called, 4); + + v = (Visited *)visited->next; + TEST_EQ (v->data, &ret); + TEST_EQ_STR (v->dirname, dirname); + strcpy (filename, dirname); + strcat (filename, "/bar"); + TEST_EQ_STR (v->path, filename); + + v = (Visited *)v->entry.next; + TEST_EQ (v->data, &ret); + TEST_EQ_STR (v->dirname, dirname); + strcpy (filename, dirname); + strcat (filename, "/bar/frodo"); + TEST_EQ_STR (v->path, filename); + + v = (Visited *)v->entry.next; + TEST_EQ (v->data, &ret); + TEST_EQ_STR (v->dirname, dirname); + strcpy (filename, dirname); + strcat (filename, "/baz"); + TEST_EQ_STR (v->path, filename); + + v = (Visited *)v->entry.next; + TEST_EQ (v->data, &ret); + TEST_EQ_STR (v->dirname, dirname); + strcpy (filename, dirname); + strcat (filename, "/frodo"); + TEST_EQ_STR (v->path, filename); + + nih_free (visited); } --- libnih-1.0.3.orig/nih/tests/test_logging.c +++ libnih-1.0.3/nih/tests/test_logging.c @@ -31,7 +31,7 @@ #include -extern char *__abort_msg __attribute__ ((weak)); +extern char *__nih_abort_msg; static NihLogLevel last_priority = NIH_LOG_UNKNOWN; static char * last_message = NULL; @@ -156,13 +156,13 @@ } - /* Check that a fatal message is also stored in the glibc __abort_msg + /* Check that a fatal message is also stored in the __nih_abort_msg * variable. */ - if (&__abort_msg) { + if (&__nih_abort_msg) { TEST_FEATURE ("with fatal message"); TEST_ALLOC_FAIL { - __abort_msg = NULL; + __nih_abort_msg = NULL; last_priority = NIH_LOG_UNKNOWN; last_message = NULL; @@ -174,16 +174,16 @@ TEST_EQ (last_priority, NIH_LOG_FATAL); TEST_EQ_STR (last_message, "message with some 20 formatting"); - TEST_NE_P (__abort_msg, NULL); - TEST_ALLOC_PARENT (__abort_msg, NULL); - TEST_EQ_STR (__abort_msg, "message with some 20 formatting"); + TEST_NE_P (__nih_abort_msg, NULL); + TEST_ALLOC_PARENT (__nih_abort_msg, NULL); + TEST_EQ_STR (__nih_abort_msg, "message with some 20 formatting"); free (last_message); } /* Check that a fatal message can safely overwrite one already stored - * in the glibc __abort_msg variable. + * in the __nih_abort_msg variable. */ TEST_FEATURE ("with second fatal message"); TEST_ALLOC_FAIL { @@ -191,7 +191,7 @@ msg = nih_strdup (NULL, "test"); } - __abort_msg = msg; + __nih_abort_msg = msg; TEST_FREE_TAG (msg); last_priority = NIH_LOG_UNKNOWN; @@ -207,14 +207,14 @@ TEST_FREE (msg); - TEST_NE_P (__abort_msg, NULL); - TEST_ALLOC_PARENT (__abort_msg, NULL); - TEST_EQ_STR (__abort_msg, "message with some 20 formatting"); + TEST_NE_P (__nih_abort_msg, NULL); + TEST_ALLOC_PARENT (__nih_abort_msg, NULL); + TEST_EQ_STR (__nih_abort_msg, "message with some 20 formatting"); free (last_message); } } else { - printf ("SKIP: __abort_msg not available\n"); + printf ("SKIP: __nih_abort_msg not available\n"); }