Devel
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- 23 participants
- 40347 discussions
[Libvir] [PATCH] virtinst: don't expect non-root users to have block device access
by Guido Guenther 29 Jan '08
by Guido Guenther 29 Jan '08
29 Jan '08
Hi,
attached patch drops the assumption that a non-root user has read access
to the guest OSes partition - he doesn't need to since all interaction
is handled via libvirt and giving the user read access for a simple MBR
block read test seems like overkill. Please apply if appropriate, patch
is against current hg.
Cheers,
-- Guido
# HG changeset patch
# User agx(a)sigxcpu.org
# Date 1201618288 -3600
# Node ID 96a103cd78dc7616a2e1e54f2e100fe156bebafd
# Parent 5109856f3bedf3b8eff7f78ce881b39bf8d30029
Don't fail if a non root user can't read from the block device due to insufficient permissions
diff -r 5109856f3bed -r 96a103cd78dc virtinst/DistroManager.py
--- a/virtinst/DistroManager.py Thu Jan 10 20:34:27 2008 -0500
+++ b/virtinst/DistroManager.py Tue Jan 29 15:51:28 2008 +0100
@@ -22,6 +22,7 @@
import logging
import os
+import errno
import gzip
import re
import struct
@@ -239,7 +240,14 @@ class DistroInstaller(Guest.Installer):
def post_install_check(self, guest):
# Check for the 0xaa55 signature at the end of the MBR
- fd = os.open(guest._install_disks[0].path, os.O_RDONLY)
+ try:
+ fd = os.open(guest._install_disks[0].path, os.O_RDONLY)
+ except OSError, (err, msg):
+ logging.debug("Failed to open guest disk: %s" % msg)
+ if err == errno.EACCES and os.geteuid() != 0:
+ return True # non root might not have access to block devices
+ else:
+ raise
buf = os.read(fd, 512)
os.close(fd)
return len(buf) == 512 and struct.unpack("H", buf[0x1fe: 0x200]) == (0xaa55,)
@@ -284,7 +292,14 @@ class PXEInstaller(Guest.Installer):
def post_install_check(self, guest):
# Check for the 0xaa55 signature at the end of the MBR
- fd = os.open(guest._install_disks[0].path, os.O_RDONLY)
+ try:
+ fd = os.open(guest._install_disks[0].path, os.O_RDONLY)
+ except OSError, (err, msg):
+ logging.debug("Failed to open guest disk: %s" % msg)
+ if err == errno.EACCES and os.geteuid() != 0:
+ return True # non root might not have access to block devices
+ else:
+ raise
buf = os.read(fd, 512)
os.close(fd)
return len(buf) == 512 and struct.unpack("H", buf[0x1fe: 0x200]) == (0xaa55,)
2
1
29 Jan '08
I tried to build static binaries in the usual libtool way,
via "configure --disable-shared" and got some link errors
due to the tests linking only with shared-lib-related files.
Here's the fix:
Avoid link errors with "configure --disable-shared".
* tests/Makefile.am (LDADDS): Add ../src/libvirt.la, so that
"configure --disable-shared" no longer provokes link errors.
---
tests/Makefile.am | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dfd9e34..1b5f287 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -33,6 +33,7 @@ LDADDS = \
$(SASL_LIBS) \
$(WARN_CFLAGS) \
$(LIBVIRT) \
+ ../src/libvirt.la \
../gnulib/lib/libgnu.la \
$(COVERAGE_LDFLAGS)
--
1.5.4.rc5.1.g0fa73
3
4
29 Jan '08
Add framework for code style- and syntax-checking rules.
Almost all tests are initially disabled via the list in Makefile.cfg.
* Makefile.am (EXTRA_DIST): Add .x-sc_avoid_if_before_free.
Omit names of files that automake includes automatically.
* .x-sc_avoid_if_before_free: New file.
* build-aux/vc-list-files: Likewise.
* build-aux/find-unnecessary-if-before-free: Likewise.
* GNUmakefile, Makefile.cfg, Makefile.maint: New files.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
.x-sc_avoid_if_before_free | 4 +
GNUmakefile | 58 ++++
Makefile.am | 8 +-
Makefile.cfg | 62 ++++
Makefile.maint | 510 +++++++++++++++++++++++++++++
build-aux/find-unnecessary-if-before-free | 41 +++
build-aux/vc-list-files | 50 +++
7 files changed, 730 insertions(+), 3 deletions(-)
create mode 100644 .x-sc_avoid_if_before_free
create mode 100644 GNUmakefile
create mode 100644 Makefile.cfg
create mode 100644 Makefile.maint
create mode 100755 build-aux/find-unnecessary-if-before-free
create mode 100755 build-aux/vc-list-files
diff --git a/.x-sc_avoid_if_before_free b/.x-sc_avoid_if_before_free
new file mode 100644
index 0000000..627dcdf
--- /dev/null
+++ b/.x-sc_avoid_if_before_free
@@ -0,0 +1,4 @@
+^gnulib/lib/getaddrinfo\.c$
+^gnulib/lib/printf-parse\.c$
+^gnulib/lib/vasnprintf\.c$
+^build-aux/find-unnecessary-if-before-free$
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 0000000..9eefe40
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,58 @@
+# Having a separate GNUmakefile lets me `include' the dynamically
+# generated rules created via Makefile.maint as well as Makefile.maint itself.
+# This makefile is used only if you run GNU Make.
+# It is necessary if you want to build targets usually of interest
+# only to the maintainer.
+
+# Copyright (C) 2001, 2003, 2006-2007 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Systems where /bin/sh is not the default shell need this. The $(shell)
+# command below won't work with e.g. stock DOS/Windows shells.
+ifeq ($(wildcard /bin/s[h]),/bin/sh)
+SHELL = /bin/sh
+else
+# will be used only with the next shell-test line, then overwritten
+# by a configured-in value
+SHELL = sh
+endif
+
+have-Makefile := $(shell test -f Makefile && echo yes)
+
+# If the user runs GNU make but has not yet run ./configure,
+# give them a diagnostic.
+ifeq ($(have-Makefile),yes)
+
+# Make tar archive easier to reproduce.
+export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
+
+include Makefile
+
+include $(srcdir)/Makefile.cfg
+include $(srcdir)/Makefile.maint
+
+else
+
+all:
+ @echo There seems to be no Makefile in this directory. 1>&2
+ @echo "You must run ./configure before running \`make'." 1>&2
+ @exit 1
+
+endif
+
+# Tell version 3.79 and up of GNU make to not build goals in this
+# directory in parallel. This is necessary in case someone tries to
+# build multiple targets on one command line.
+.NOTPARALLEL:
diff --git a/Makefile.am b/Makefile.am
index 34a1eb5..5154203 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,9 +5,11 @@ SUBDIRS = gnulib/lib include src qemud proxy docs gnulib/tests \
ACLOCAL_AMFLAGS = -I m4 -I gnulib/m4
-EXTRA_DIST = libvirt.spec.in libvirt.spec COPYING.LIB \
- libvirt.pc.in libvirt.pc TODO AUTHORS ChangeLog \
- NEWS README $(man_MANS) autobuild.sh
+EXTRA_DIST = \
+ libvirt.spec libvirt.spec.in \
+ libvirt.pc libvirt.pc.in \
+ $(man_MANS) autobuild.sh \
+ .x-sc_avoid_if_before_free
man_MANS = virsh.1
diff --git a/Makefile.cfg b/Makefile.cfg
new file mode 100644
index 0000000..f1194d1
--- /dev/null
+++ b/Makefile.cfg
@@ -0,0 +1,62 @@
+# Customize Makefile.maint. -*- makefile -*-
+# Copyright (C) 2003-2007 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Use alpha.gnu.org for alpha and beta releases.
+# Use ftp.gnu.org for major releases.
+gnu_ftp_host-alpha = alpha.gnu.org
+gnu_ftp_host-beta = alpha.gnu.org
+gnu_ftp_host-major = ftp.gnu.org
+gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
+
+url_dir_list = \
+ ftp://$(gnu_rel_host)/gnu/coreutils
+
+# Tests not to run as part of "make distcheck".
+local-checks-to-skip = \
+ po-check \
+ makefile_path_separator_check \
+ makefile-check \
+ sc_no_have_config_h \
+ sc_unmarked_diagnostics \
+ sc_tight_scope \
+ sc_trailing_blank \
+ sc_GPL_version \
+ sc_always_defined_macros \
+ sc_cast_of_alloca_return_value \
+ sc_cast_of_argument_to_free \
+ sc_cast_of_x_alloc_return_value \
+ sc_changelog \
+ sc_dd_max_sym_length \
+ sc_error_exit_success \
+ sc_file_system \
+ sc_obsolete_symbols \
+ sc_prohibit_assert_without_use \
+ sc_prohibit_atoi_atof \
+ sc_prohibit_jm_in_m4 \
+ sc_prohibit_quote_without_use \
+ sc_prohibit_quotearg_without_use \
+ sc_prohibit_strcmp \
+ sc_require_config_h \
+ sc_root_tests \
+ sc_space_tab \
+ sc_sun_os_names \
+ sc_system_h_headers \
+ sc_the_the \
+ sc_two_space_separator_in_usage \
+ sc_useless_cpp_parens \
+ patch-check \
+ check-AUTHORS \
+ changelog-check
diff --git a/Makefile.maint b/Makefile.maint
new file mode 100644
index 0000000..0336f13
--- /dev/null
+++ b/Makefile.maint
@@ -0,0 +1,510 @@
+# This is reported not to work with make-3.79.1
+# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
+ME := Makefile.maint
+
+# Do not save the original name or timestamp in the .tar.gz file.
+# Use --rsyncable if available.
+gzip_rsyncable := \
+ $(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo --rsyncable)
+GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
+
+CVS_LIST = build-aux/vc-list-files
+
+CVS_LIST_EXCEPT = \
+$(CVS_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi
+
+# Prevent programs like 'sort' from considering distinct strings to be equal.
+# Doing it here saves us from having to set LC_ALL elsewhere in this file.
+export LC_ALL = C
+
+# Collect the names of rules starting with `sc_'.
+syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' $(ME))
+.PHONY: $(syntax-check-rules)
+
+# Checks that don't require cvs.
+# Run `changelog-check' last, as previous test may reveal problems requiring
+# new ChangeLog entries.
+local-checks-available = \
+ po-check copyright-check m4-check author_mark_check \
+ changelog-check patch-check strftime-check $(syntax-check-rules) \
+ makefile_path_separator_check \
+ makefile-check check-AUTHORS
+.PHONY: $(local-checks-available)
+
+local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
+
+syntax-check: $(local-check)
+
+## --------------- ##
+## Sanity checks. ##
+## --------------- ##
+
+sc_avoid_if_before_free:
+ @$(srcdir)/build-aux/find-unnecessary-if-before-free \
+ $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): found useless "if" before "free" above' 1>&2; \
+ exit 1; } || :
+
+sc_cast_of_argument_to_free:
+ @grep -nE '\<free \(\(' $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): don'\''t cast free argument' 1>&2; \
+ exit 1; } || :
+
+sc_cast_of_x_alloc_return_value:
+ @grep -nE '\*\) *x(m|c|re)alloc\>' $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
+ exit 1; } || :
+
+sc_cast_of_alloca_return_value:
+ @grep -nE '\*\) *alloca\>' $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): don'\''t cast alloca return value' 1>&2; \
+ exit 1; } || :
+
+sc_space_tab:
+ @grep -n '[ ] ' $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
+ 1>&2; exit 1; } || :
+
+# Don't use *scanf or the old ato* functions in `real' code.
+# They provide no error checking mechanism.
+# Instead, use strto* functions.
+sc_prohibit_atoi_atof:
+ @grep -nE '\<([fs]?scanf|ato([filq]|ll))\>' $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): do not use *scan''f, ato''f, ato''i, ato''l, ato''ll, ato''q, or ss''canf' \
+ 1>&2; exit 1; } || :
+
+# Use STREQ rather than comparing strcmp == 0, or != 0.
+sc_prohibit_strcmp:
+ @grep -nE '! *str''cmp \(|\<str''cmp \([^)]+\) *==' \
+ $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): use STREQ in place of the above uses of str''cmp' \
+ 1>&2; exit 1; } || :
+
+# Using EXIT_SUCCESS as the first argument to error is misleading,
+# since when that parameter is 0, error does not exit. Use `0' instead.
+sc_error_exit_success:
+ @grep -nF 'error (EXIT_SUCCESS,' \
+ $$(find -type f -name '*.[chly]') && \
+ { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
+ exit 1; } || :
+
+sc_file_system:
+ @grep -ni 'file''system' $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): found use of "file''system";' \
+ 'rewrite to use "file system"' 1>&2; \
+ exit 1; } || :
+
+sc_no_have_config_h:
+ @grep -n 'HAVE''_CONFIG_H' $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
+ 1>&2; exit 1; } || :
+
+# Nearly all .c files must include <config.h>.
+sc_require_config_h:
+ @if $(CVS_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
+ grep -L '^# *include <config\.h>' \
+ $$($(CVS_LIST_EXCEPT) | grep '\.c$$') \
+ | grep . && \
+ { echo '$(ME): the above files do not include <config.h>' \
+ 1>&2; exit 1; } || :; \
+ else :; \
+ fi
+
+# Prohibit the inclusion of assert.h without an actual use of assert.
+sc_prohibit_assert_without_use:
+ @if $(CVS_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
+ files=$$(grep -l '# *include <assert\.h>' \
+ $$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
+ grep -L '\<assert (' $$files \
+ | grep . && \
+ { echo "$(ME): the above files include <assert.h> but don't use it" \
+ 1>&2; exit 1; } || :; \
+ else :; \
+ fi
+
+# Don't include quotearg.h unless you use one of its functions.
+sc_prohibit_quotearg_without_use:
+ @if $(CVS_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
+ files=$$(grep -l '# *include "quotearg\.h"' \
+ $$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
+ grep -LE '\<quotearg(_[^ ]+)? \(' $$files \
+ | grep . && \
+ { echo "$(ME): the above files include "quotearg.h" but don't use it" \
+ 1>&2; exit 1; } || :; \
+ else :; \
+ fi
+
+# Don't include quote.h unless you use one of its functions.
+sc_prohibit_quote_without_use:
+ @if $(CVS_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
+ files=$$(grep -l '# *include "quote\.h"' \
+ $$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
+ grep -LE '\<quote(_n)? \(' $$files \
+ | grep . && \
+ { echo "$(ME): the above files include "quote.h" but don't use it" \
+ 1>&2; exit 1; } || :; \
+ else :; \
+ fi
+
+sc_obsolete_symbols:
+ @grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
+ $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
+ 1>&2; exit 1; } || :
+
+# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
+
+# Each nonempty line must start with a year number, or a TAB.
+sc_changelog:
+ @grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) && \
+ { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
+ exit 1; } || :
+
+# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
+# with the strings from the two affected variables.
+dd_c = $(srcdir)/src/dd.c
+sc_dd_max_sym_length:
+ifneq ($(wildcard $(dd_c)),)
+ @len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
+ sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
+ |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
+ | wc --max-line-length); \
+ max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
+ |tr -d '"' | wc --max-line-length); \
+ if test "$$len" = "$$max"; then :; else \
+ echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
+ exit 1; \
+ fi
+endif
+
+# Many m4 macros names once began with `jm_'.
+# On 2004-04-13, they were all changed to start with gl_ instead.
+# Make sure that none are inadvertently reintroduced.
+sc_prohibit_jm_in_m4:
+ @grep -nE 'jm_[A-Z]' \
+ $$($(CVS_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \
+ { echo '$(ME): do not use jm_ in m4 macro names' \
+ 1>&2; exit 1; } || :
+
+sc_root_tests:
+ @if test -d tests \
+ && grep check-root tests/Makefile.am>/dev/null 2>&1; then \
+ t1=sc-root.expected; t2=sc-root.actual; \
+ grep -nl '^PRIV_CHECK_ARG=require-root' \
+ $$($(CVS_LIST) tests) |sed s,tests,., |sort > $$t1; \
+ sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \
+ $(srcdir)/tests/Makefile.am |sort > $$t2; \
+ diff -u $$t1 $$t2 || diff=1; \
+ rm -f $$t1 $$t2; \
+ test "$$diff" \
+ && { echo 'tests/Makefile.am: missing check-root action'>&2; \
+ exit 1; } || :; \
+ fi
+
+headers_with_interesting_macro_defs = \
+ exit.h \
+ fcntl_.h \
+ fnmatch_.h \
+ intprops.h \
+ inttypes_.h \
+ lchown.h \
+ openat.h \
+ stat-macros.h \
+ stdint_.h
+
+# Create a list of regular expressions matching the names
+# of macros that are guaranteed by parts of gnulib to be defined.
+.re-defmac:
+ @(cd $(srcdir)/lib; \
+ for f in $(headers_with_interesting_macro_defs); do \
+ test -f $$f && \
+ sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
+ done; \
+ ) | sort -u \
+ | grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
+ | sed 's/^/^# *define /' \
+ > $@-t
+ @mv $@-t $@
+
+# Don't define macros that we already get from gnulib header files.
+sc_always_defined_macros: .re-defmac
+ @if test -f $(srcdir)/src/system.h; then \
+ trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
+ grep -f .re-defmac $$($(CVS_LIST)) \
+ && { echo '$(ME): define the above via some gnulib .h file' \
+ 1>&2; exit 1; } || :; \
+ fi
+
+# Create a list of regular expressions matching the names
+# of files included from system.h. Exclude a couple.
+.re-list:
+ @sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
+ | grep -Ev 'sys/(param|file)\.h' \
+ | sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
+ > $@-t
+ @mv $@-t $@
+
+# Files in src/ should not include directly any of
+# the headers already included via system.h.
+sc_system_h_headers: .re-list
+ @if test -f $(srcdir)/src/system.h; then \
+ trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
+ grep -nE -f .re-list \
+ $$($(CVS_LIST) src | \
+ grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
+ && { echo '$(ME): the above are already included via system.h'\
+ 1>&2; exit 1; } || :; \
+ fi
+
+sc_sun_os_names:
+ @grep -nEi \
+ 'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
+ $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
+ exit 1; } || :
+
+sc_the_the:
+ @grep -ni '\<the ''the\>' $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): found use of "the ''the";' 1>&2; \
+ exit 1; } || :
+
+sc_tight_scope:
+ $(MAKE) -C src $@
+
+sc_trailing_blank:
+ @grep -n '[ ]$$' $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): found trailing blank(s)' \
+ 1>&2; exit 1; } || :
+
+# Match lines like the following, but where there is only one space
+# between the options and the description:
+# -D, --all-repeated[=delimit-method] print all duplicate lines\n
+longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)?
+sc_two_space_separator_in_usage:
+ @grep -nE '^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \
+ $$($(CVS_LIST_EXCEPT)) && \
+ { echo "$(ME): help2man requires at least two spaces between"; \
+ echo "$(ME): an option and its description"; \
+ 1>&2; exit 1; } || :
+
+# Look for diagnostics that aren't marked for translation.
+# This won't find any for which error's format string is on a separate line.
+sc_unmarked_diagnostics:
+ @grep -nE \
+ '\<error \([^"]*"[^"]*[a-z]{3}' $$($(CVS_LIST_EXCEPT)) \
+ | grep -v '_''(' && \
+ { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
+ exit 1; } || :
+
+# Avoid useless parentheses like those in this example:
+# #if defined (SYMBOL) || defined (SYM2)
+sc_useless_cpp_parens:
+ @grep -n '^# *if .*defined *(' $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): found useless parentheses in cpp directive' \
+ 1>&2; exit 1; } || :
+
+# Require the latest GPL.
+sc_GPL_version:
+ @grep -n 'either ''version [^3]' $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): GPL vN, N!=3' 1>&2; exit 1; } || :
+
+# Ensure that the c99-to-c89 patch applies cleanly.
+patch-check:
+ rm -rf src-c89 $@.1 $@.2
+ cp -a src src-c89
+ (cd src-c89; patch -p1 -V never --fuzz=0) < src/c99-to-c89.diff \
+ > $@.1 2>&1
+ if test "$$REGEN_PATCH" = yes; then \
+ diff -upr src src-c89 | sed 's,src-c89/,src/,' \
+ | grep -v '^Only in' > new-diff || : ; fi
+ grep -v '^patching file ' $@.1 > $@.2 || :
+ msg=ok; test -s $@.2 && msg='fuzzy patch' || : ; \
+ rm -f src-c89/*.o || msg='rm failed'; \
+ $(MAKE) -C src-c89 CFLAGS='-Wdeclaration-after-statement -Werror' \
+ || msg='compile failure with extra options'; \
+ test "$$msg" = ok && rm -rf src-c89 $@.1 $@.2 || echo "$$msg" 1>&2; \
+ test "$$msg" = ok
+
+# Ensure that date's --help output stays in sync with the info
+# documentation for GNU strftime. The only exception is %N,
+# which date accepts but GNU strftime does not.
+extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
+strftime-check:
+ if test -f $(srcdir)/src/date.c; then \
+ grep '^ %. ' $(srcdir)/src/date.c | sort \
+ | $(extract_char) > $@-src; \
+ { echo N; \
+ info libc date calendar format | grep '^ `%.'\' \
+ | $(extract_char); } | sort > $@-info; \
+ diff -u $@-src $@-info || exit 1; \
+ rm -f $@-src $@-info; \
+ fi
+
+check-AUTHORS:
+ $(MAKE) -C src $@
+
+# Ensure that we use only the standard $(VAR) notation,
+# not @...@ in Makefile.am, now that we can rely on automake
+# to emit a definition for each substituted variable.
+makefile-check:
+ grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \
+ && { echo 'Makefile.maint: use $$(...), not @...@' 1>&2; exit 1; } || :
+
+news-date-check: NEWS
+ today=`date +%Y-%m-%d`; \
+ if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
+ >/dev/null; then \
+ :; \
+ else \
+ echo "version or today's date is not in NEWS" 1>&2; \
+ exit 1; \
+ fi
+
+changelog-check:
+ if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
+ >/dev/null; then \
+ :; \
+ else \
+ echo "$(VERSION) not in ChangeLog" 1>&2; \
+ exit 1; \
+ fi
+
+m4-check:
+ @grep -n 'AC_DEFUN([^[]' m4/*.m4 \
+ && { echo 'Makefile.maint: quote the first arg to AC_DEFUN' 1>&2; \
+ exit 1; } || :
+
+# Verify that all source files using _() are listed in po/POTFILES.in.
+# FIXME: don't hard-code file names below; use a more general mechanism.
+po-check:
+ if test -f po/POTFILES.in; then \
+ grep -E -v '^(#|$$)' po/POTFILES.in \
+ | grep -v '^src/false\.c$$' | sort > $@-1; \
+ files=; \
+ for file in $$($(CVS_LIST_EXCEPT)); do \
+ case $$file in \
+ *.[ch]) \
+ base=`expr " $$file" : ' \(.*\)\..'`; \
+ { test -f $$base.l || test -f $$base.y; } && continue;; \
+ *) continue;; \
+ esac; \
+ files="$$files $$file"; \
+ done; \
+ grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files \
+ | sort -u > $@-2; \
+ diff -u $@-1 $@-2 || exit 1; \
+ rm -f $@-1 $@-2; \
+ fi
+
+# In a definition of #define AUTHORS "... and ..." where the RHS contains
+# the English word `and', the string must be marked with `N_ (...)' so that
+# gettext recognizes it as a string requiring translation.
+author_mark_check:
+ @grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
+ { echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \
+ exit 1; } || :
+
+# Sometimes it is useful to change the PATH environment variable
+# in Makefiles. When doing so, it's better not to use the Unix-centric
+# path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
+# It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
+# and there probably aren't many projects with so many Makefile.am files
+# that we'd have to worry about limits on command line length.
+msg = 'Makefile.maint: Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
+makefile_path_separator_check:
+ @grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
+ && { echo $(msg) 1>&2; exit 1; } || :
+
+# Check that `make alpha' will not fail at the end of the process.
+writable-files:
+ if test -d $(release_archive_dir); then :; else \
+ mkdir $(release_archive_dir); \
+ fi
+ for file in $(distdir).tar.gz $(xd-delta) \
+ $(release_archive_dir)/$(distdir).tar.gz \
+ $(release_archive_dir)/$(xd-delta); do \
+ test -e $$file || continue; \
+ test -w $$file \
+ || { echo ERROR: $$file is not writable; fail=1; }; \
+ done; \
+ test "$$fail" && exit 1 || :
+
+v_etc_file = lib/version-etc.c
+sample-test = tests/sample-test
+texi = doc/$(PACKAGE).texi
+# Make sure that the copyright date in $(v_etc_file) is up to date.
+# Do the same for the $(sample-test) and the main doc/.texi file.
+copyright-check:
+ @if test -f $(v_etc_file); then \
+ grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
+ >/dev/null \
+ || { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
+ exit 1; }; \
+ fi
+ @if test -f $(sample-test); then \
+ grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test) \
+ >/dev/null \
+ || { echo 'out of date copyright in $(sample-test); update it' 1>&2; \
+ exit 1; }; \
+ fi
+ @if test -f $(texi); then \
+ grep 'Copyright @copyright{} .*'$$(date +%Y)' Free' $(texi) \
+ >/dev/null \
+ || { echo 'out of date copyright in $(texi); update it' 1>&2; \
+ exit 1; }; \
+ fi
+
+vc-diff-check:
+ $(VC) diff > vc-diffs || :
+ if test -s vc-diffs; then \
+ cat vc-diffs; \
+ echo "Some files are locally modified:" 1>&2; \
+ exit 1; \
+ else \
+ rm vc-diffs; \
+ fi
+
+cvs-check: vc-diff-check
+
+maintainer-distcheck:
+ $(MAKE) distcheck
+ $(MAKE) my-distcheck
+
+# Use -Wformat -Werror to detect format-string/arg-list mismatches.
+# Also, check for shadowing problems with -Wshadow, and for pointer
+# arithmetic problems with -Wpointer-arith.
+# These CFLAGS are pretty strict. If you build this target, you probably
+# have to have a recent version of gcc and glibc headers.
+# The for-loop below ensures that there is a bin/ directory full of all
+# of the programs under test (except the few that are required for basic
+# Makefile rules), all symlinked to the just-built "false" program.
+# This is to ensure that if ever a test neglects to make PATH include
+# the build srcdir, these always-failing programs will run.
+# Otherwise, it is too easy to test the wrong programs.
+# Note that "false" itself is a symlink to true, so it too will malfunction.
+TMPDIR ?= /tmp
+t=$(TMPDIR)/$(PACKAGE)/test
+my-distcheck: $(local-check) check
+ -rm -rf $(t)
+ mkdir -p $(t)
+ GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
+ cd $(t)/$(distdir) \
+ && ./configure --disable-nls \
+ && $(MAKE) CFLAGS='$(warn_cflags)' \
+ AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
+ && $(MAKE) dvi \
+ && $(MAKE) distclean
+ (cd $(t) && mv $(distdir) $(distdir).old \
+ && $(AMTAR) -zxf - ) < $(distdir).tar.gz
+ diff -ur $(t)/$(distdir).old $(t)/$(distdir)
+ if test -f $(srcdir)/src/c99-to-c89.diff; then \
+ cd $(t)/$(distdir) \
+ && (cd src && patch -V never --fuzz=0 <c99-to-c89.diff) \
+ && ./configure --disable-largefile \
+ CFLAGS='-Werror -ansi -Wno-long-long' \
+ && $(MAKE); \
+ fi
+ -rm -rf $(t)
+ @echo "========================"; \
+ echo "$(distdir).tar.gz is ready for distribution"; \
+ echo "========================"
diff --git a/build-aux/find-unnecessary-if-before-free b/build-aux/find-unnecessary-if-before-free
new file mode 100755
index 0000000..2b415f9
--- /dev/null
+++ b/build-aux/find-unnecessary-if-before-free
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+# Detect instances of "if (p) free (p);".
+# Likewise for "if (p != NULL) free (p);".
+# Exit status is like grep: 0 for no match. 1 for any number.
+
+# Note: giving line numbers isn't practical, since I've reset the
+# input record separator.
+use strict;
+use warnings;
+(my $ME = $0) =~ s|.*/||;
+
+{
+ # Use ';' as the input record separator.
+ $/ = ';';
+
+ my $found_match = 0;
+ foreach my $file (@ARGV)
+ {
+ open FH, '<', $file
+ or die "$ME: can't open `$file' for reading: $!\n";
+ while (defined (my $line = <FH>))
+ {
+ if ($line =~
+ /\b(if\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)
+ \s+(?:sexpr_)?free\s*\(\s*\2\s*\))/sx)
+ {
+ print "$file: $1\n";
+ $found_match = 1;
+ }
+ }
+ close FH;
+ }
+ exit !$found_match;
+}
+
+my $foo = <<'EOF';
+# The above is to *find* them.
+# This adjusts them, removing the unnecessary "if (p)" part.
+
+perl -0x3b -pi -e 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+((?:sexpr_)?free\s*\(\s*\1\s*\))/$2/s' $(git ls-files|grep -v '^gnulib')
+EOF
diff --git a/build-aux/vc-list-files b/build-aux/vc-list-files
new file mode 100755
index 0000000..72a6f54
--- /dev/null
+++ b/build-aux/vc-list-files
@@ -0,0 +1,50 @@
+#!/bin/sh
+# List the specified version-controlled files.
+
+# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+# List the specified version-controlled files.
+# With no argument, list them all.
+# This script must be run solely from the top of a $srcdir build directory.
+
+# If there's an argument, it must be a single, "."-relative directory name.
+# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
+
+dir=
+case $# in
+ 0) ;;
+ 1) dir=$1 ;;
+ *) echo "$0: too many arguments" 1>&2; exit 1 ;;
+esac
+
+test "x$dir" = x && dir=.
+
+if test -d CVS; then
+ if test -x build-aux/cvsu; then
+ build-aux/cvsu --find --types=AFGM "$dir"
+ else
+ awk -F/ '{ \
+ if (!$1 && $3 !~ /^-/) { \
+ f=FILENAME; \
+ sub(/CVS\/Entries/, "", f); \
+ print f $2; \
+ }}' \
+ $(find ${*-*} -name Entries -print) /dev/null;
+ fi
+else
+ git-ls-files "$dir"
+fi
--
1.5.4.rc4.15.g215c5
3
5
Once I had a static "virsh" binary, I ran this:
cd src && valgrind --leak-check=full ./virsh --connect \
test://$PWD/../docs/testnode.xml list
which exposed some leaks.
I fixed them like this:
Plug test-related leaks.
* src/test.c (testLoadNetwork): Free forwardDev.
(testLoadDomain): Free ctxt.
(testLoadNetwork): Likewise.
(testOpenFromFile): Likewise.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
src/test.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/test.c b/src/test.c
index d228b31..c46a045 100644
--- a/src/test.c
+++ b/src/test.c
@@ -351,9 +351,11 @@ static int testLoadDomain(virConnectPtr conn,
privconn->domains[handle].onPoweroff = onPoweroff;
privconn->domains[handle].onCrash = onCrash;
+ xmlXPathFreeContext(ctxt);
return (handle);
error:
+ xmlXPathFreeContext(ctxt);
if (name)
free(name);
return (-1);
@@ -508,6 +510,7 @@ static int testLoadNetwork(virConnectPtr conn,
if (forwardDev) {
strncpy(privconn->networks[handle].forwardDev, forwardDev, sizeof(privconn->networks[handle].forwardDev)-1);
privconn->networks[handle].forwardDev[sizeof(privconn->networks[handle].forwardDev)-1] = '\0';
+ free(forwardDev);
}
strncpy(privconn->networks[handle].ipAddress, ipaddress, sizeof(privconn->networks[handle].ipAddress)-1);
@@ -522,9 +525,12 @@ static int testLoadNetwork(virConnectPtr conn,
strncpy(privconn->networks[handle].dhcpEnd, dhcpend, sizeof(privconn->networks[handle].dhcpEnd)-1);
privconn->networks[handle].dhcpEnd[sizeof(privconn->networks[handle].dhcpEnd)-1] = '\0';
free(dhcpend);
+ xmlXPathFreeContext(ctxt);
return (handle);
error:
+ xmlXPathFreeContext(ctxt);
+ free (forwardDev);
if (ipaddress)
free(ipaddress);
if (ipnetmask)
@@ -833,11 +839,13 @@ static int testOpenFromFile(virConnectPtr conn,
}
}
+ xmlXPathFreeContext(ctxt);
xmlFreeDoc(xml);
return (0);
error:
+ xmlXPathFreeContext(ctxt);
if (domains != NULL)
free(domains);
if (networks != NULL)
--
1.5.4.rc5.1.g0fa73
3
2
Enable the duplicate-"the" test; fix violations
* Makefile.cfg (local-checks-to-skip) [sc_the_the]: Enable.
* docs/virsh.pod: Remove a duplicate "the".
* libvirt.spec.in: Likewise.
* virsh.1: Likewise.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
Makefile.cfg | 1 -
docs/virsh.pod | 2 +-
libvirt.spec.in | 2 +-
virsh.1 | 2 +-
4 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/Makefile.cfg b/Makefile.cfg
index f1194d1..ba59f29 100644
--- a/Makefile.cfg
+++ b/Makefile.cfg
@@ -54,7 +54,6 @@ local-checks-to-skip = \
sc_space_tab \
sc_sun_os_names \
sc_system_h_headers \
- sc_the_the \
sc_two_space_separator_in_usage \
sc_useless_cpp_parens \
patch-check \
diff --git a/docs/virsh.pod b/docs/virsh.pod
index 8166db7..8f4086c 100644
--- a/docs/virsh.pod
+++ b/docs/virsh.pod
@@ -327,7 +327,7 @@ anymore.
=item B<resume> I<domain-id>
Moves a domain out of the suspended state. This will allow a previously
-suspended domain to now be eligible for scheduling by the the underlying
+suspended domain to now be eligible for scheduling by the underlying
hypervisor.
=item B<ttyconsole> I<domain-id>
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 9b3fa67..8e918b9 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -75,7 +75,7 @@ Obsoletes: libvir-python
%description python
The libvirt-python package contains a module that permits applications
written in the Python programming language to use the interface
-supplied by the libvirt library to use the the virtualization capabilities
+supplied by the libvirt library to use the virtualization capabilities
of recent versions of Linux (and other OSes).
%prep
diff --git a/virsh.1 b/virsh.1
index 09df396..fa4675c 100644
--- a/virsh.1
+++ b/virsh.1
@@ -409,7 +409,7 @@ anymore.
.IP "\fBresume\fR \fIdomain-id\fR" 4
.IX Item "resume domain-id"
Moves a domain out of the suspended state. This will allow a previously
-suspended domain to now be eligible for scheduling by the the underlying
+suspended domain to now be eligible for scheduling by the underlying
hypervisor.
.IP "\fBttyconsole\fR \fIdomain-id\fR" 4
.IX Item "ttyconsole domain-id"
--
1.5.4.rc4.15.g215c5
3
5
Given code like if (foo) free (foo); remove the useless "if (foo) " part.
Likewise, given if (foo != NULL) free (foo); remove the useless "if" test.
* proxy/libvirt_proxy.c: Remove unnecessary "if" test before free.
* python/generator.py: Likewise.
* qemud/qemud.c: Likewise.
* src/buf.c: Likewise.
* src/conf.c: Likewise.
* src/hash.c: Likewise.
* src/iptables.c: Likewise.
* src/libvirt.c: Likewise.
* src/openvz_conf.c: Likewise.
* src/qemu_conf.c: Likewise.
* src/qemu_driver.c: Likewise.
* src/remote_internal.c: Likewise.
* src/test.c: Likewise.
* src/virsh.c: Likewise.
* src/virterror.c: Likewise.
* src/xen_internal.c: Likewise.
* src/xen_unified.c: Likewise.
* src/xend_internal.c: Likewise.
* src/xm_internal.c: Likewise.
* src/xml.c: Likewise.
* src/xmlrpc.c: Likewise.
* src/xs_internal.c: Likewise.
* tests/testutils.c: Likewise.
* tests/xencapstest.c: Likewise.
* tests/xmconfigtest.c: Likewise.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
proxy/libvirt_proxy.c | 3 +-
python/generator.py | 2 +-
qemud/qemud.c | 5 +--
src/buf.c | 3 +-
src/conf.c | 7 +----
src/hash.c | 15 ++++---------
src/iptables.c | 6 +---
src/libvirt.c | 6 ++--
src/openvz_conf.c | 3 +-
src/qemu_conf.c | 8 ++----
src/qemu_driver.c | 18 +++++-----------
src/remote_internal.c | 26 ++++++++++++------------
src/test.c | 24 +++++++--------------
src/virsh.c | 53 ++++++++++++++++--------------------------------
src/virterror.c | 12 +++-------
src/xen_internal.c | 9 ++-----
src/xen_unified.c | 12 +++-------
src/xend_internal.c | 44 +++++++++++++---------------------------
src/xm_internal.c | 15 ++++---------
src/xml.c | 21 ++++++-------------
src/xmlrpc.c | 20 +++++-------------
src/xs_internal.c | 2 -
tests/testutils.c | 3 +-
tests/xencapstest.c | 3 +-
tests/xmconfigtest.c | 3 +-
25 files changed, 112 insertions(+), 211 deletions(-)
diff --git a/proxy/libvirt_proxy.c b/proxy/libvirt_proxy.c
index d8f2e64..5ccf855 100644
--- a/proxy/libvirt_proxy.c
+++ b/proxy/libvirt_proxy.c
@@ -505,8 +505,7 @@ retry2:
memcpy(&request.extra.str[0], uuid, VIR_UUID_BUFLEN);
strcpy(&request.extra.str[VIR_UUID_BUFLEN], name);
}
- if (name)
- free(name);
+ free(name);
break;
}
case VIR_PROXY_LOOKUP_UUID: {
diff --git a/python/generator.py b/python/generator.py
index 7625a93..30b03fd 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -375,7 +375,7 @@ def print_function_wrapper(name, output, export, include):
if ret[0] == 'void':
if file == "python_accessor":
if args[1][1] == "char *":
- c_call = "\n if (%s->%s != NULL) free(%s->%s);\n" % (
+ c_call = "\n free(%s->%s);\n" % (
args[0][0], args[1][0], args[0][0], args[1][0])
c_call = c_call + " %s->%s = (%s)strdup((const xmlChar *)%s);\n" % (args[0][0],
args[1][0], args[1][1], args[1][0])
diff --git a/qemud/qemud.c b/qemud/qemud.c
index 7d25b9d..5f3c875 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -1133,7 +1133,7 @@ static void qemudDispatchClientFailure(struct qemud_server *server, struct qemud
#if HAVE_SASL
if (client->saslconn) sasl_dispose(&client->saslconn);
- if (client->saslUsername) free(client->saslUsername);
+ free(client->saslUsername);
#endif
if (client->tlssession) gnutls_deinit (client->tlssession);
close(client->fd);
@@ -1639,8 +1639,7 @@ static void qemudCleanup(struct qemud_server *server) {
if (server->saslUsernameWhitelist) {
char **list = server->saslUsernameWhitelist;
while (*list) {
- if (*list)
- free(*list);
+ free(*list);
list++;
}
}
diff --git a/src/buf.c b/src/buf.c
index 5f58027..188d040 100644
--- a/src/buf.c
+++ b/src/buf.c
@@ -150,8 +150,7 @@ void
virBufferFree(virBufferPtr buf)
{
if (buf) {
- if (buf->content)
- free(buf->content);
+ free(buf->content);
free(buf);
}
}
diff --git a/src/conf.c b/src/conf.c
index 62c42ff..8e66d84 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -490,7 +490,6 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
ret = calloc(1, sizeof(*ret));
if (ret == NULL) {
virConfError(NULL, VIR_ERR_NO_MEMORY, _("allocating configuration"), 0);
- if (str != NULL)
free(str);
return(NULL);
}
@@ -642,8 +641,7 @@ virConfParseStatement(virConfParserCtxtPtr ctxt)
if (virConfAddEntry(ctxt->conf, name, value, comm) == NULL) {
free(name);
virConfFreeValue(value);
- if (comm != NULL)
- free(comm);
+ free(comm);
return(-1);
}
return(0);
@@ -776,8 +774,7 @@ __virConfFree(virConfPtr conf)
virConfEntryPtr next;
free(tmp->name);
virConfFreeValue(tmp->value);
- if (tmp->comment)
- free(tmp->comment);
+ free(tmp->comment);
next = tmp->next;
free(tmp);
tmp = next;
diff --git a/src/hash.c b/src/hash.c
index d95eea9..4e4ce60 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -226,8 +226,7 @@ virHashFree(virHashTablePtr table, virHashDeallocator f)
next = iter->next;
if ((f != NULL) && (iter->payload != NULL))
f(iter->payload, iter->name);
- if (iter->name)
- free(iter->name);
+ free(iter->name);
iter->payload = NULL;
if (!inside_table)
free(iter);
@@ -453,8 +452,7 @@ virHashRemoveEntry(virHashTablePtr table, const char *name,
if ((f != NULL) && (entry->payload != NULL))
f(entry->payload, entry->name);
entry->payload = NULL;
- if (entry->name)
- free(entry->name);
+ free(entry->name);
if (prev) {
prev->next = entry->next;
free(entry);
@@ -538,8 +536,7 @@ int virHashRemoveSet(virHashTablePtr table, virHashSearcher iter, virHashDealloc
if (iter(entry->payload, entry->name, data)) {
count++;
f(entry->payload, entry->name);
- if (entry->name)
- free(entry->name);
+ free(entry->name);
if (prev) {
prev->next = entry->next;
free(entry);
@@ -812,8 +809,7 @@ __virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid)
error:
pthread_mutex_unlock(&conn->lock);
if (ret != NULL) {
- if (ret->name != NULL)
- free(ret->name );
+ free(ret->name );
free(ret);
}
return(NULL);
@@ -946,8 +942,7 @@ __virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid)
error:
pthread_mutex_unlock(&conn->lock);
if (ret != NULL) {
- if (ret->name != NULL)
- free(ret->name );
+ free(ret->name );
free(ret);
}
return(NULL);
diff --git a/src/iptables.c b/src/iptables.c
index 5ac9be6..b59faa4 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -254,8 +254,7 @@ iptRulesSave(iptRules *rules)
static void
iptRuleFree(iptRule *rule)
{
- if (rule->rule)
- free(rule->rule);
+ free(rule->rule);
rule->rule = NULL;
if (rule->argv) {
@@ -488,8 +487,7 @@ iptablesAddRemoveRule(iptRules *rules, int action, const char *arg, ...)
}
error:
- if (rule)
- free(rule);
+ free(rule);
if (argv) {
n = 0;
diff --git a/src/libvirt.c b/src/libvirt.c
index 31e1278..f4ee2e0 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -615,7 +615,7 @@ do_open (const char *name,
return ret;
failed:
- if (ret->name) free (ret->name);
+ free (ret->name);
if (ret->driver) ret->driver->close (ret);
if (uri) xmlFreeURI(uri);
virUnrefConnect(ret);
@@ -1974,8 +1974,8 @@ virDomainMigrate (virDomainPtr domain,
ddomain = virDomainLookupByName (dconn, dname);
done:
- if (uri_out) free (uri_out);
- if (cookie) free (cookie);
+ free (uri_out);
+ free (cookie);
return ddomain;
}
diff --git a/src/openvz_conf.c b/src/openvz_conf.c
index a886001..4e4019c 100644
--- a/src/openvz_conf.c
+++ b/src/openvz_conf.c
@@ -494,8 +494,7 @@ static struct openvz_vm_def
return def;
bail_out:
- if (prop)
- free(prop);
+ free(prop);
if (obj)
xmlXPathFreeObject(obj);
if (ctxt)
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index 922223e..0de641d 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -1379,8 +1379,7 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
return def;
error:
- if (prop)
- free(prop);
+ free(prop);
if (obj)
xmlXPathFreeObject(obj);
if (ctxt)
@@ -1468,8 +1467,7 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
no_memory:
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "tapfds");
error:
- if (retval)
- free(retval);
+ free(retval);
if (tapfd != -1)
close(tapfd);
return NULL;
@@ -1941,7 +1939,7 @@ qemudParseVMDeviceDef(virConnectPtr conn,
error:
if (xml) xmlFreeDoc(xml);
- if (dev) free(dev);
+ free(dev);
return NULL;
}
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 566fb76..71a3125 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -228,7 +228,7 @@ qemudStartup(void) {
out_of_memory:
qemudLog (QEMUD_ERR, "qemudStartup: out of memory");
- if (base) free (base);
+ free (base);
free(qemu_driver);
qemu_driver = NULL;
return -1;
@@ -330,17 +330,11 @@ qemudShutdown(void) {
qemu_driver->nactivenetworks = 0;
qemu_driver->ninactivenetworks = 0;
- if (qemu_driver->configDir)
- free(qemu_driver->configDir);
- if (qemu_driver->autostartDir)
- free(qemu_driver->autostartDir);
- if (qemu_driver->networkConfigDir)
- free(qemu_driver->networkConfigDir);
- if (qemu_driver->networkAutostartDir)
- free(qemu_driver->networkAutostartDir);
-
- if (qemu_driver->vncTLSx509certdir)
- free(qemu_driver->vncTLSx509certdir);
+ free(qemu_driver->configDir);
+ free(qemu_driver->autostartDir);
+ free(qemu_driver->networkConfigDir);
+ free(qemu_driver->networkAutostartDir);
+ free(qemu_driver->vncTLSx509certdir);
if (qemu_driver->brctl)
brShutdown(qemu_driver->brctl);
diff --git a/src/remote_internal.c b/src/remote_internal.c
index 860b4d8..4d855ab 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -735,13 +735,13 @@ doRemoteOpen (virConnectPtr conn,
cleanup:
/* Free up the URL and strings. */
- if (name) free (name);
- if (command) free (command);
- if (sockname) free (sockname);
- if (authtype) free (authtype);
- if (netcat) free (netcat);
- if (username) free (username);
- if (port) free (port);
+ free (name);
+ free (command);
+ free (sockname);
+ free (authtype);
+ free (netcat);
+ free (username);
+ free (port);
if (cmd_argv) {
char **cmd_argv_ptr = cmd_argv;
while (*cmd_argv_ptr) {
@@ -1139,10 +1139,10 @@ doRemoteClose (virConnectPtr conn, struct private_data *priv)
#endif
/* Free hostname copy */
- if (priv->hostname) free (priv->hostname);
+ free (priv->hostname);
/* See comment for remoteType. */
- if (priv->type) free (priv->type);
+ free (priv->type);
/* Free private data. */
priv->magic = DEAD;
@@ -3267,7 +3267,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
/* This server call shows complete, and earlier client step was OK */
if (complete && err == SASL_OK) {
- if (serverin) free(serverin);
+ free(serverin);
break;
}
}
@@ -3297,9 +3297,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
ret = 0;
cleanup:
- if (localAddr) free(localAddr);
- if (remoteAddr) free(remoteAddr);
- if (serverin) free(serverin);
+ free(localAddr);
+ free(remoteAddr);
+ free(serverin);
free(saslcb);
remoteAuthFreeCredentials(cred, ncred);
diff --git a/src/test.c b/src/test.c
index d228b31..d39207f 100644
--- a/src/test.c
+++ b/src/test.c
@@ -354,8 +354,7 @@ static int testLoadDomain(virConnectPtr conn,
return (handle);
error:
- if (name)
- free(name);
+ free(name);
return (-1);
}
@@ -525,16 +524,11 @@ static int testLoadNetwork(virConnectPtr conn,
return (handle);
error:
- if (ipaddress)
- free(ipaddress);
- if (ipnetmask)
- free(ipnetmask);
- if (dhcpstart)
- free(dhcpstart);
- if (dhcpend)
- free(dhcpend);
- if (name)
- free(name);
+ free(ipaddress);
+ free(ipnetmask);
+ free(dhcpstart);
+ free(dhcpend);
+ free(name);
return (-1);
}
@@ -838,10 +832,8 @@ static int testOpenFromFile(virConnectPtr conn,
return (0);
error:
- if (domains != NULL)
- free(domains);
- if (networks != NULL)
- free(networks);
+ free(domains);
+ free(networks);
if (xml)
xmlFreeDoc(xml);
if (fd != -1)
diff --git a/src/virsh.c b/src/virsh.c
index 78c7c85..d081008 100644
--- a/src/virsh.c
+++ b/src/virsh.c
@@ -428,8 +428,7 @@ cmdConnect(vshControl * ctl, vshCmd * cmd)
ctl->conn = NULL;
}
- if (ctl->name)
- free(ctl->name);
+ free(ctl->name);
ctl->name = vshStrdup(ctl, vshCommandOptString(cmd, "name", NULL));
if (!ro) {
@@ -577,8 +576,7 @@ cmdList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
maxname = virConnectNumOfDefinedDomains(ctl->conn);
if (maxname < 0) {
vshError(ctl, FALSE, "%s", _("Failed to list inactive domains"));
- if (ids)
- free(ids);
+ free(ids);
return FALSE;
}
if (maxname) {
@@ -586,8 +584,7 @@ cmdList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
if ((maxname = virConnectListDefinedDomains(ctl->conn, names, maxname)) < 0) {
vshError(ctl, FALSE, "%s", _("Failed to list inactive domains"));
- if (ids)
- free(ids);
+ free(ids);
free(names);
return FALSE;
}
@@ -639,10 +636,8 @@ cmdList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
virDomainFree(dom);
free(names[i]);
}
- if (ids)
- free(ids);
- if (names)
- free(names);
+ free(ids);
+ free(names);
return TRUE;
}
@@ -1217,8 +1212,7 @@ cmdSchedinfo(vshControl * ctl, vshCmd * cmd)
}
}
cleanup:
- if (params)
- free(params);
+ free(params);
virDomainFree(dom);
return ret_val;
}
@@ -2513,8 +2507,7 @@ cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
maxinactive = virConnectNumOfDefinedNetworks(ctl->conn);
if (maxinactive < 0) {
vshError(ctl, FALSE, "%s", _("Failed to list inactive networks"));
- if (activeNames)
- free(activeNames);
+ free(activeNames);
return FALSE;
}
if (maxinactive) {
@@ -2522,8 +2515,7 @@ cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
if ((maxinactive = virConnectListDefinedNetworks(ctl->conn, inactiveNames, maxinactive)) < 0) {
vshError(ctl, FALSE, "%s", _("Failed to list inactive networks"));
- if (activeNames)
- free(activeNames);
+ free(activeNames);
free(inactiveNames);
return FALSE;
}
@@ -2581,10 +2573,8 @@ cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
virNetworkFree(network);
free(inactiveNames[i]);
}
- if (activeNames)
- free(activeNames);
- if (inactiveNames)
- free(inactiveNames);
+ free(activeNames);
+ free(inactiveNames);
return TRUE;
}
@@ -3230,10 +3220,8 @@ cmdAttachInterface(vshControl * ctl, vshCmd * cmd)
cleanup:
if (dom)
virDomainFree(dom);
- if (buf)
- free(buf);
- if (tmp)
- free(tmp);
+ free(buf);
+ free(tmp);
return ret;
}
@@ -3516,10 +3504,8 @@ cmdAttachDisk(vshControl * ctl, vshCmd * cmd)
cleanup:
if (dom)
virDomainFree(dom);
- if (buf)
- free(buf);
- if (tmp)
- free(tmp);
+ free(buf);
+ free(tmp);
return ret;
}
@@ -3868,8 +3854,7 @@ vshCommandOptFree(vshCmdOpt * arg)
a = a->next;
- if (tmp->data)
- free(tmp->data);
+ free(tmp->data);
free(tmp);
}
}
@@ -4267,7 +4252,7 @@ vshCommandParse(vshControl * ctl, char *cmdstr)
c->next = NULL;
if (!vshCommandCheckOpts(ctl, c)) {
- if(c) free(c);
+ free(c);
goto syntaxError;
}
@@ -4286,8 +4271,7 @@ vshCommandParse(vshControl * ctl, char *cmdstr)
vshCommandFree(ctl->cmd);
if (first)
vshCommandOptFree(first);
- if (tkdata)
- free(tkdata);
+ free(tkdata);
return FALSE;
}
@@ -4791,8 +4775,7 @@ static int
vshDeinit(vshControl * ctl)
{
vshCloseLogFile(ctl);
- if (ctl->name)
- free(ctl->name);
+ free(ctl->name);
if (ctl->conn) {
if (virConnectClose(ctl->conn) != 0) {
ctl->conn = NULL; /* prevent recursive call from vshError() */
diff --git a/src/virterror.c b/src/virterror.c
index 0c0423b..bf4062d 100644
--- a/src/virterror.c
+++ b/src/virterror.c
@@ -109,14 +109,10 @@ virResetError(virErrorPtr err)
{
if (err == NULL)
return;
- if (err->message != NULL)
- free(err->message);
- if (err->str1 != NULL)
- free(err->str1);
- if (err->str2 != NULL)
- free(err->str2);
- if (err->str3 != NULL)
- free(err->str3);
+ free(err->message);
+ free(err->str1);
+ free(err->str2);
+ free(err->str3);
memset(err, 0, sizeof(virError));
}
diff --git a/src/xen_internal.c b/src/xen_internal.c
index 6b3b1dc..a8cecef 100644
--- a/src/xen_internal.c
+++ b/src/xen_internal.c
@@ -1680,8 +1680,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu,
op.u.setvcpumapd5.cpumap.nr_cpus = nr_cpus;
}
ret = xenHypervisorDoV2Dom(handle, &op);
- if (new)
- free(new);
+ free(new);
if (unlock_pages(cpumap, maplen) < 0) {
virXenError(NULL, VIR_ERR_XEN_CALL, " release", maplen);
@@ -2056,15 +2055,13 @@ xenHypervisorInit(void)
virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl ", IOCTL_PRIVCMD_HYPERCALL);
close(fd);
in_init = 0;
- if (ipt)
- free(ipt);
+ free(ipt);
return(-1);
done:
close(fd);
in_init = 0;
- if (ipt)
- free(ipt);
+ free(ipt);
return(0);
}
diff --git a/src/xen_unified.c b/src/xen_unified.c
index 187b7f5..d46e63b 100644
--- a/src/xen_unified.c
+++ b/src/xen_unified.c
@@ -200,12 +200,9 @@ xenDomainUsedCpus(virDomainPtr dom)
}
done:
- if (cpulist != NULL)
- free(cpulist);
- if (cpumap != NULL)
- free(cpumap);
- if (cpuinfo != NULL)
- free(cpuinfo);
+ free(cpulist);
+ free(cpumap);
+ free(cpuinfo);
return(res);
}
@@ -912,9 +909,8 @@ xenUnifiedDomainDumpXML (virDomainPtr dom, int flags)
char *cpus, *res;
cpus = xenDomainUsedCpus(dom);
res = xenDaemonDomainDumpXML(dom, flags, cpus);
- if (cpus != NULL)
free(cpus);
- return(res);
+ return(res);
}
if (priv->opened[XEN_UNIFIED_PROXY_OFFSET])
return xenProxyDomainDumpXML(dom, flags);
diff --git a/src/xend_internal.c b/src/xend_internal.c
index a9fc332..61af69b 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -620,8 +620,7 @@ xend_op_ext2(virConnectPtr xend, const char *path, char *error,
}
ret = http2unix(xend, xend_post(xend, path, buf.content, error, n_error));
- if (buf.content != NULL)
- free(buf.content);
+ free(buf.content);
return ret;
}
@@ -1640,10 +1639,8 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root,
virBufferAdd(&buf, " </disk>\n", 12);
bad_parse:
- if (drvName)
- free(drvName);
- if (drvType)
- free(drvType);
+ free(drvName);
+ free(drvType);
} else if (sexpr_lookup(node, "device/vif")) {
const char *tmp2;
tmp2 = sexpr_node(node, "device/vif/script");
@@ -1809,8 +1806,7 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root,
return (buf.content);
error:
- if (buf.content != NULL)
- free(buf.content);
+ free(buf.content);
return (NULL);
}
@@ -2809,7 +2805,6 @@ xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids)
}
error:
- if (root != NULL)
sexpr_free(root);
return(ret);
}
@@ -2843,7 +2838,6 @@ xenDaemonNumOfDomains(virConnectPtr conn)
}
error:
- if (root != NULL)
sexpr_free(root);
return(ret);
}
@@ -2877,8 +2871,7 @@ xenDaemonLookupByID(virConnectPtr conn, int id) {
return (ret);
error:
- if (name != NULL)
- free(name);
+ free(name);
return (NULL);
}
@@ -3152,10 +3145,8 @@ xenDaemonCreateLinux(virConnectPtr conn, const char *xmlDesc,
sexpr = virDomainParseXMLDesc(conn, xmlDesc, &name, priv->xendConfigVersion);
if ((sexpr == NULL) || (name == NULL)) {
virXendError(conn, VIR_ERR_XML_ERROR, "domain");
- if (sexpr != NULL)
- free(sexpr);
- if (name != NULL)
- free(name);
+ free(sexpr);
+ free(name);
return (NULL);
}
@@ -3187,8 +3178,7 @@ xenDaemonCreateLinux(virConnectPtr conn, const char *xmlDesc,
xenDaemonDomainDestroy(dom);
virUnrefDomain(dom);
}
- if (name != NULL)
- free(name);
+ free(name);
return (NULL);
}
@@ -3228,8 +3218,7 @@ xenDaemonAttachDevice(virDomainPtr domain, const char *xml)
str = virDomainGetOSType(domain);
if (strcmp(str, "linux"))
hvm = 1;
- if (str)
- free(str);
+ free(str);
sexpr = virParseXMLDevice(domain->conn, xml, hvm, priv->xendConfigVersion);
if (sexpr == NULL)
return (-1);
@@ -3460,10 +3449,8 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) {
sexpr = virDomainParseXMLDesc(conn, xmlDesc, &name, priv->xendConfigVersion);
if ((sexpr == NULL) || (name == NULL)) {
virXendError(conn, VIR_ERR_XML_ERROR, "domain");
- if (sexpr != NULL)
- free(sexpr);
- if (name != NULL)
- free(name);
+ free(sexpr);
+ free(name);
return (NULL);
}
@@ -3482,8 +3469,7 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) {
return (dom);
error:
- if (name != NULL)
- free(name);
+ free(name);
return (NULL);
}
int xenDaemonDomainCreate(virDomainPtr domain)
@@ -3558,8 +3544,7 @@ xenDaemonNumOfDefinedDomains(virConnectPtr conn)
}
error:
- if (root != NULL)
- sexpr_free(root);
+ sexpr_free(root);
return(ret);
}
@@ -3591,8 +3576,7 @@ int xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxn
}
error:
- if (root != NULL)
- sexpr_free(root);
+ sexpr_free(root);
return(ret);
}
diff --git a/src/xm_internal.c b/src/xm_internal.c
index 6b502d0..90dc1a4 100644
--- a/src/xm_internal.c
+++ b/src/xm_internal.c
@@ -1307,10 +1307,8 @@ int xenXMDomainPinVcpu(virDomainPtr domain,
ret = 0;
cleanup:
- if(mapstr)
- free(mapstr);
- if(ranges)
- free(ranges);
+ free(mapstr);
+ free(ranges);
return (ret);
}
@@ -1865,8 +1863,7 @@ static char *xenXMParseXMLVif(virConnectPtr conn, xmlNodePtr node, int hvm) {
}
cleanup:
- if (bridge != NULL)
- free(bridge);
+ free(bridge);
if (mac != NULL)
xmlFree(mac);
if (source != NULL)
@@ -2238,8 +2235,7 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
if (!vif)
goto error;
if (!(thisVif = malloc(sizeof(*thisVif)))) {
- if (vif)
- free(vif);
+ free(vif);
xenXMError(conn, VIR_ERR_NO_MEMORY, "config");
goto error;
}
@@ -2410,8 +2406,7 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
return (ret);
error:
- if (entry)
- free(entry);
+ free(entry);
if (conf)
virConfFree(conf);
return (NULL);
diff --git a/src/xml.c b/src/xml.c
index c698889..a546002 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -397,14 +397,12 @@ virParseXenCpuTopology(virConnectPtr conn, virBufferPtr xml,
parse_error:
virXMLError(conn, VIR_ERR_XEN_CALL, _("topology syntax error"), 0);
error:
- if (cpuset != NULL)
- free(cpuset);
+ free(cpuset);
return (-1);
memory_error:
- if (cpuset != NULL)
- free(cpuset);
+ free(cpuset);
virXMLError(conn, VIR_ERR_NO_MEMORY, _("allocate buffer"), 0);
return (-1);
}
@@ -1066,16 +1064,14 @@ virDomainParseXMLOSDescHVM(virConnectPtr conn, xmlNodePtr node,
if (str != NULL && !strcmp(str, "localtime")) {
virBufferAdd(buf, "(localtime 1)", 13);
}
- if (str)
- free(str);
+ free(str);
virBufferAdd(buf, "))", 2);
return (0);
error:
- if (nodes)
- free(nodes);
+ free(nodes);
return (-1);
}
@@ -1723,8 +1719,7 @@ virDomainParseXMLDesc(virConnectPtr conn, const char *xmldesc, char **name,
vcpus, xendConfigVersion);
}
- if (str != NULL)
- free(str);
+ free(str);
if (res != 0)
goto error;
@@ -1797,8 +1792,7 @@ virDomainParseXMLDesc(virConnectPtr conn, const char *xmldesc, char **name,
return (buf.content);
error:
- if (nam != NULL)
- free(nam);
+ free(nam);
if (name != NULL)
*name = NULL;
if (ctxt != NULL)
@@ -1807,8 +1801,7 @@ virDomainParseXMLDesc(virConnectPtr conn, const char *xmldesc, char **name,
xmlFreeDoc(xml);
if (pctxt != NULL)
xmlFreeParserCtxt(pctxt);
- if (buf.content != NULL)
- free(buf.content);
+ free(buf.content);
return (NULL);
}
diff --git a/src/xmlrpc.c b/src/xmlrpc.c
index b433ef5..f956f0d 100644
--- a/src/xmlrpc.c
+++ b/src/xmlrpc.c
@@ -115,8 +115,7 @@ static xmlRpcValuePtr xmlRpcValueUnmarshalInteger(xmlNodePtr node)
if (ret && value)
ret->value.integer = atoi(value);
- if (value)
- free(value);
+ free(value);
return ret;
}
@@ -131,8 +130,7 @@ static xmlRpcValuePtr xmlRpcValueUnmarshalBoolean(xmlNodePtr node)
ret->value.boolean = true;
else
ret->value.boolean = false;
- if (value)
- free(value);
+ free(value);
return ret;
}
@@ -143,8 +141,7 @@ static xmlRpcValuePtr xmlRpcValueUnmarshalDouble(xmlNodePtr node)
if (ret && value)
ret->value.real = atof(value);
- if (value)
- free(value);
+ free(value);
return ret;
}
@@ -198,8 +195,7 @@ static xmlRpcValueDictElementPtr xmlRpcValueUnmarshalDictElement(xmlNodePtr node
ret->value = xmlRpcValueUnmarshal(cur);
} else {
xmlRpcError(VIR_ERR_XML_ERROR, _("unexpected dict node"), 0);
- if (ret->name)
- free(ret->name);
+ free(ret->name);
if (ret->value)
xmlRpcValueFree(ret->value);
free(ret);
@@ -679,12 +675,8 @@ xmlRpcContextPtr xmlRpcContextNew(const char *uri)
void xmlRpcContextFree(xmlRpcContextPtr context)
{
if (context) {
- if (context->uri)
- free(context->uri);
-
- if (context->faultMessage)
- free(context->faultMessage);
-
+ free(context->uri);
+ free(context->faultMessage);
free(context);
}
}
diff --git a/src/xs_internal.c b/src/xs_internal.c
index 726af30..1dbbba6 100644
--- a/src/xs_internal.c
+++ b/src/xs_internal.c
@@ -635,9 +635,7 @@ xenStoreLookupByName(virConnectPtr conn, const char *name)
ret->id = id;
done:
- if (xenddomain != NULL)
free(xenddomain);
- if (idlist != NULL)
free(idlist);
return(ret);
diff --git a/tests/testutils.c b/tests/testutils.c
index 1141edb..4fea6b6 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -83,8 +83,7 @@ virtTestRun(const char *title, int nloops, int (*body)(const void *data), const
else
fprintf(stderr, "%-50s ... FAILED\n", title);
- if (ts)
- free(ts);
+ free(ts);
return ret;
}
diff --git a/tests/xencapstest.c b/tests/xencapstest.c
index dd1c386..bf9ce07 100644
--- a/tests/xencapstest.c
+++ b/tests/xencapstest.c
@@ -62,8 +62,7 @@ static int testCompareFiles(const char *hostmachine,
fail:
- if (actualxml)
- free(actualxml);
+ free(actualxml);
if (fp1)
fclose(fp1);
if (fp2)
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index f49ca6c..51f4b67 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -153,8 +153,7 @@ static int testCompareFormatXML(const char *xmcfg_rel, const char *xml_rel,
fail:
if (conf)
virConfFree(conf);
- if (gotxml)
- free(gotxml);
+ free(gotxml);
if (conn) {
conn->privateData = old_priv;
--
1.5.4.rc4.15.g215c5
3
4
Enabling these is easy, since they test for things for which
there are no violations.
--------------------
Subject: [PATCH] Enable two more tests.
* Makefile.cfg (local-checks-to-skip)
[sc_cast_of_x_alloc_return_value, sc_cast_of_argument_to_free]: Enable.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
Makefile.cfg | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/Makefile.cfg b/Makefile.cfg
index dfca3fc..9e75fda 100644
--- a/Makefile.cfg
+++ b/Makefile.cfg
@@ -35,8 +35,6 @@ local-checks-to-skip = \
sc_GPL_version \
sc_always_defined_macros \
sc_cast_of_alloca_return_value \
- sc_cast_of_argument_to_free \
- sc_cast_of_x_alloc_return_value \
sc_changelog \
sc_dd_max_sym_length \
sc_error_exit_success \
--
1.5.4.rc4.15.g215c5
3
2
Enable the <assert.h>-checking test; fix violations.
* Makefile.cfg (local-checks-to-skip)
[sc_prohibit_assert_without_use]: Enable.
* qemud/mdns.c: Don't include <assert.h>; no uses of assert here.
* qemud/qemud.c: Likewise.
* qemud/remote.c: Likewise.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
Makefile.cfg | 1 -
qemud/mdns.c | 1 -
qemud/qemud.c | 1 -
qemud/remote.c | 1 -
4 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/Makefile.cfg b/Makefile.cfg
index 697fde4..dfca3fc 100644
--- a/Makefile.cfg
+++ b/Makefile.cfg
@@ -42,7 +42,6 @@ local-checks-to-skip = \
sc_error_exit_success \
sc_file_system \
sc_obsolete_symbols \
- sc_prohibit_assert_without_use \
sc_prohibit_atoi_atof \
sc_prohibit_jm_in_m4 \
sc_prohibit_quote_without_use \
diff --git a/qemud/mdns.c b/qemud/mdns.c
index 1585b5b..cebf9a4 100644
--- a/qemud/mdns.c
+++ b/qemud/mdns.c
@@ -29,7 +29,6 @@
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
#include <avahi-client/client.h>
#include <avahi-client/publish.h>
diff --git a/qemud/qemud.c b/qemud/qemud.c
index 77a2352..e853538 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -44,7 +44,6 @@
#include <string.h>
#include <errno.h>
#include <getopt.h>
-#include <assert.h>
#include <fnmatch.h>
#include <grp.h>
#include <signal.h>
diff --git a/qemud/remote.c b/qemud/remote.c
index b5b0ef6..57f8f29 100644
--- a/qemud/remote.c
+++ b/qemud/remote.c
@@ -43,7 +43,6 @@
#include <errno.h>
#include <getopt.h>
#include <ctype.h>
-#include <assert.h>
#include <fnmatch.h>
#ifdef HAVE_POLKIT
--
1.5.4.rc4.15.g215c5
3
2
29 Jan '08
Enable the <config.h>-requiring test; fix violations
Use <config.h>, not "config.h", per autoconf documentation.
* Makefile.cfg (local-checks-to-skip) [sc_require_config_h]: Enable.
* .x-sc_require_config_h: New file, to list exempted files.
* Makefile.am (EXTRA_DIST): Add .x-sc_require_config_h.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
.x-sc_require_config_h | 5 +++++
ChangeLog | 8 ++++----
Makefile.am | 3 ++-
Makefile.cfg | 1 -
proxy/libvirt_proxy.c | 2 +-
python/libvir.c | 2 +-
python/types.c | 2 +-
qemud/event.c | 2 +-
qemud/qemud.c | 2 +-
src/bridge.h | 2 +-
src/buf.c | 2 +-
src/conf.c | 2 +-
src/console.c | 2 +-
src/event.c | 2 +-
src/gnutls_1_0_compat.h | 2 +-
src/hash.c | 2 +-
src/iptables.c | 2 +-
src/libvirt.c | 2 +-
src/nodeinfo.c | 2 +-
src/openvz_conf.c | 2 +-
src/proxy_internal.c | 2 +-
src/qemu_conf.c | 2 +-
src/qemu_conf.h | 2 +-
src/qemu_driver.c | 2 +-
src/qemu_driver.h | 2 +-
src/remote_internal.c | 2 +-
src/sexpr.c | 2 +-
src/stats_linux.c | 2 +-
src/test.c | 2 +-
src/util.c | 2 +-
src/uuid.c | 2 +-
src/virsh.c | 2 +-
src/virterror.c | 2 +-
src/xen_internal.c | 2 +-
src/xen_unified.c | 2 +-
src/xend_internal.c | 2 +-
src/xm_internal.c | 2 +-
src/xml.c | 2 +-
src/xmlrpc.c | 2 +-
src/xs_internal.c | 2 +-
tests/conftest.c | 2 +-
tests/nodeinfotest.c | 2 +-
tests/qemuxml2argvtest.c | 2 +-
tests/qemuxml2xmltest.c | 2 +-
tests/reconnect.c | 2 +-
tests/sexpr2xmltest.c | 2 +-
tests/testutils.c | 2 +-
tests/virshtest.c | 2 +-
tests/xencapstest.c | 2 +-
tests/xmconfigtest.c | 2 +-
tests/xml2sexprtest.c | 2 +-
tests/xmlrpctest.c | 2 +-
52 files changed, 59 insertions(+), 54 deletions(-)
create mode 100644 .x-sc_require_config_h
diff --git a/.x-sc_require_config_h b/.x-sc_require_config_h
new file mode 100644
index 0000000..e0903ac
--- /dev/null
+++ b/.x-sc_require_config_h
@@ -0,0 +1,5 @@
+^docs/examples/info1\.c$
+^docs/examples/suspend\.c$
+^gnulib/lib/dummy\.c$
+^gnulib/tests/dummy\.c$
+^qemud/remote_protocol\.c$
diff --git a/ChangeLog b/ChangeLog
index 5493e51..7d5e058 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -555,7 +555,7 @@ Fri Dec 7 14:27:00 UTC 2007 Richard W.M. Jones <rjones(a)redhat.com>
Fri Dec 7 11:06:58 CET 2007 Jim Meyering <meyering(a)redhat.com>
- Include "config.h" in remaining non-generated files.
+ Include <config.h> in remaining non-generated files.
* proxy/libvirt_proxy.c: Likewise.
* python/libvir.c: Likewise.
* python/types.c: Likewise.
@@ -619,7 +619,7 @@ Wed Dec 5 23:57:53 CET 2007 Jim Meyering <meyering(a)redhat.com>
Wed Dec 5 22:38:18 CET 2007 Jim Meyering <meyering(a)redhat.com>
- Include "config.h".
+ Include <config.h>.
* qemud/event.c: Likewise.
* src/buf.c: Likewise.
* src/hash.c: Likewise.
@@ -673,10 +673,10 @@ Wed Dec 5 22:30:03 CET 2007 Jim Meyering <meyering(a)redhat.com>
* tests/nodeinfodata/linux-nodeinfo-5.txt:
* tests/nodeinfodata/linux-nodeinfo-6.txt:
* src/test.c [WITH_TEST]: Remove definition of _GNU_SOURCE that
- would conflict with the one now in "config.h".
+ would conflict with the one now in <config.h>.
* autogen.sh: Add -I gnulib/m4.
* src/conf.c, src/sexpr.c: Don't define _GNU_SOURCE.
- Instead, include "config.h".
+ Instead, include <config.h>.
* qemud/qemud.c: Remove definition of _GNU_SOURCE.
* src/openvz_driver.c: Likewise.
* src/qemu_driver.c: Likewise.
diff --git a/Makefile.am b/Makefile.am
index 5154203..e32033a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,7 +9,8 @@ EXTRA_DIST = \
libvirt.spec libvirt.spec.in \
libvirt.pc libvirt.pc.in \
$(man_MANS) autobuild.sh \
- .x-sc_avoid_if_before_free
+ .x-sc_avoid_if_before_free \
+ .x-sc_require_config_h
man_MANS = virsh.1
diff --git a/Makefile.cfg b/Makefile.cfg
index ba59f29..2c1c9e7 100644
--- a/Makefile.cfg
+++ b/Makefile.cfg
@@ -49,7 +49,6 @@ local-checks-to-skip = \
sc_prohibit_quote_without_use \
sc_prohibit_quotearg_without_use \
sc_prohibit_strcmp \
- sc_require_config_h \
sc_root_tests \
sc_space_tab \
sc_sun_os_names \
diff --git a/proxy/libvirt_proxy.c b/proxy/libvirt_proxy.c
index 5ccf855..83cf39d 100644
--- a/proxy/libvirt_proxy.c
+++ b/proxy/libvirt_proxy.c
@@ -9,7 +9,7 @@
* Daniel Veillard <veillard(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#ifdef WITH_XEN
diff --git a/python/libvir.c b/python/libvir.c
index 0fe11f2..e2f7c5b 100644
--- a/python/libvir.c
+++ b/python/libvir.c
@@ -9,7 +9,7 @@
* Daniel Veillard <veillard(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#include <Python.h>
#include "libvirt/libvirt.h"
diff --git a/python/types.c b/python/types.c
index 146bb24..c91d8da 100644
--- a/python/types.c
+++ b/python/types.c
@@ -7,7 +7,7 @@
* Daniel Veillard <veillard(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#include "libvirt_wrap.h"
diff --git a/qemud/event.c b/qemud/event.c
index b7d75a0..ca7dc11 100644
--- a/qemud/event.c
+++ b/qemud/event.c
@@ -21,7 +21,7 @@
* Author: Daniel P. Berrange <berrange(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#include <stdlib.h>
#include <string.h>
diff --git a/qemud/qemud.c b/qemud/qemud.c
index 5f3c875..77a2352 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -21,7 +21,7 @@
* Author: Daniel P. Berrange <berrange(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#include <sys/types.h>
#include <sys/wait.h>
diff --git a/src/bridge.h b/src/bridge.h
index 52f805b..5dcca00 100644
--- a/src/bridge.h
+++ b/src/bridge.h
@@ -22,7 +22,7 @@
#ifndef __QEMUD_BRIDGE_H__
#define __QEMUD_BRIDGE_H__
-#include "config.h"
+#include <config.h>
#ifdef WITH_QEMU
diff --git a/src/buf.c b/src/buf.c
index 188d040..5bb2bd4 100644
--- a/src/buf.c
+++ b/src/buf.c
@@ -8,7 +8,7 @@
* Daniel Veillard <veillard(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#include "libvirt/libvirt.h"
diff --git a/src/conf.c b/src/conf.c
index 8e66d84..8b3aae5 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -8,7 +8,7 @@
* Daniel Veillard <veillard(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#include <string.h>
diff --git a/src/console.c b/src/console.c
index 6b336d9..02a9c7f 100644
--- a/src/console.c
+++ b/src/console.c
@@ -20,7 +20,7 @@
* Daniel Berrange <berrange(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#ifndef __MINGW32__
diff --git a/src/event.c b/src/event.c
index 7dcbf32..274db9d 100644
--- a/src/event.c
+++ b/src/event.c
@@ -21,7 +21,7 @@
* Author: Daniel P. Berrange <berrange(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#include "event.h"
diff --git a/src/gnutls_1_0_compat.h b/src/gnutls_1_0_compat.h
index 7ec8b63..38f6954 100644
--- a/src/gnutls_1_0_compat.h
+++ b/src/gnutls_1_0_compat.h
@@ -22,7 +22,7 @@
#ifndef LIBVIRT_GNUTLS_1_0_COMPAT_H__
-#include "config.h"
+#include <config.h>
#ifdef GNUTLS_1_0_COMPAT
#define gnutls_session_t gnutls_session
diff --git a/src/hash.c b/src/hash.c
index 4e4ce60..d92c92c 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -18,7 +18,7 @@
* Daniel Veillard <veillard(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#include <string.h>
#include <stdlib.h>
diff --git a/src/iptables.c b/src/iptables.c
index b59faa4..1486411 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -19,7 +19,7 @@
* Mark McLoughlin <markmc(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#if WITH_QEMU
diff --git a/src/libvirt.c b/src/libvirt.c
index f4ee2e0..defadc1 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -9,7 +9,7 @@
* Daniel Veillard <veillard(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#include "libvirt/libvirt.h"
#include <stdio.h>
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 1b0191b..65a2cf1 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -21,7 +21,7 @@
* Author: Daniel P. Berrange <berrange(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/openvz_conf.c b/src/openvz_conf.c
index 4e4019c..9084184 100644
--- a/src/openvz_conf.c
+++ b/src/openvz_conf.c
@@ -27,7 +27,7 @@
#ifdef WITH_OPENVZ
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/proxy_internal.c b/src/proxy_internal.c
index e0e5631..a8a7962 100644
--- a/src/proxy_internal.c
+++ b/src/proxy_internal.c
@@ -10,7 +10,7 @@
#ifdef WITH_XEN
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index 0de641d..9886300 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -21,7 +21,7 @@
* Author: Daniel P. Berrange <berrange(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#ifdef WITH_QEMU
diff --git a/src/qemu_conf.h b/src/qemu_conf.h
index 7b242f7..9f09ec1 100644
--- a/src/qemu_conf.h
+++ b/src/qemu_conf.h
@@ -24,7 +24,7 @@
#ifndef __QEMUD_CONF_H
#define __QEMUD_CONF_H
-#include "config.h"
+#include <config.h>
#ifdef WITH_QEMU
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 71a3125..f80a121 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -21,7 +21,7 @@
* Author: Daniel P. Berrange <berrange(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#ifdef WITH_QEMU
diff --git a/src/qemu_driver.h b/src/qemu_driver.h
index 66b60b7..72b397c 100644
--- a/src/qemu_driver.h
+++ b/src/qemu_driver.h
@@ -25,7 +25,7 @@
#ifndef QEMUD_DRIVER_H
#define QEMUD_DRIVER_H
-#include "config.h"
+#include <config.h>
#ifdef WITH_QEMU
diff --git a/src/remote_internal.c b/src/remote_internal.c
index 4d855ab..aa6bb5c 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -21,7 +21,7 @@
* Author: Richard Jones <rjones(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
/* Windows socket compatibility functions. */
#include "socketcompat.h"
diff --git a/src/sexpr.c b/src/sexpr.c
index bbf0791..e7ea6c8 100644
--- a/src/sexpr.c
+++ b/src/sexpr.c
@@ -10,7 +10,7 @@
* archive for more details.
*/
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/stats_linux.c b/src/stats_linux.c
index de73cef..d2dda88 100644
--- a/src/stats_linux.c
+++ b/src/stats_linux.c
@@ -8,7 +8,7 @@
* Richard W.M. Jones <rjones(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
/* This file only applies on Linux. */
#ifdef __linux__
diff --git a/src/test.c b/src/test.c
index d39207f..2afd86f 100644
--- a/src/test.c
+++ b/src/test.c
@@ -21,7 +21,7 @@
* Daniel Berrange <berrange(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#ifdef WITH_TEST
diff --git a/src/util.c b/src/util.c
index f16aaf4..0c42124 100644
--- a/src/util.c
+++ b/src/util.c
@@ -24,7 +24,7 @@
* File created Jul 18, 2007 - Shuveb Hussain <shuveb(a)binarykarma.com>
*/
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdarg.h>
diff --git a/src/uuid.c b/src/uuid.c
index b2022c4..ae30217 100644
--- a/src/uuid.c
+++ b/src/uuid.c
@@ -19,7 +19,7 @@
* Mark McLoughlin <markmc(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#include "uuid.h"
diff --git a/src/virsh.c b/src/virsh.c
index d081008..a1b3e38 100644
--- a/src/virsh.c
+++ b/src/virsh.c
@@ -13,7 +13,7 @@
* $Id$
*/
-#include "config.h"
+#include <config.h>
#include "libvirt/libvirt.h"
#include "libvirt/virterror.h"
diff --git a/src/virterror.c b/src/virterror.c
index bf4062d..83cf7ca 100644
--- a/src/virterror.c
+++ b/src/virterror.c
@@ -8,7 +8,7 @@
* Author: Daniel Veillard <veillard(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/xen_internal.c b/src/xen_internal.c
index a8cecef..1292382 100644
--- a/src/xen_internal.c
+++ b/src/xen_internal.c
@@ -10,7 +10,7 @@
#ifdef WITH_XEN
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/xen_unified.c b/src/xen_unified.c
index d46e63b..d5b2ec2 100644
--- a/src/xen_unified.c
+++ b/src/xen_unified.c
@@ -8,7 +8,7 @@
* Richard W.M. Jones <rjones(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#ifdef WITH_XEN
diff --git a/src/xend_internal.c b/src/xend_internal.c
index 61af69b..814d16f 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -11,7 +11,7 @@
*/
#ifdef WITH_XEN
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <sys/types.h>
diff --git a/src/xm_internal.c b/src/xm_internal.c
index 90dc1a4..57d0eb4 100644
--- a/src/xm_internal.c
+++ b/src/xm_internal.c
@@ -23,7 +23,7 @@
*/
#ifdef WITH_XEN
-#include "config.h"
+#include <config.h>
#include <dirent.h>
#include <time.h>
diff --git a/src/xml.c b/src/xml.c
index a546002..76ca91c 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -8,7 +8,7 @@
* Daniel Veillard <veillard(a)redhat.com>
*/
-#include "config.h"
+#include <config.h>
#include "libvirt/libvirt.h"
diff --git a/src/xmlrpc.c b/src/xmlrpc.c
index f956f0d..ac4ea6e 100644
--- a/src/xmlrpc.c
+++ b/src/xmlrpc.c
@@ -8,7 +8,7 @@
* Anthony Liguori <aliguori(a)us.ibm.com>
*/
-#include "config.h"
+#include <config.h>
#include "xmlrpc.h"
#include "internal.h"
diff --git a/src/xs_internal.c b/src/xs_internal.c
index 1dbbba6..6d8610c 100644
--- a/src/xs_internal.c
+++ b/src/xs_internal.c
@@ -9,7 +9,7 @@
*/
#ifdef WITH_XEN
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <string.h>
diff --git a/tests/conftest.c b/tests/conftest.c
index abb68fd..637b737 100644
--- a/tests/conftest.c
+++ b/tests/conftest.c
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
#include <unistd.h>
#include <stdlib.h>
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index 969b85c..c80e65c 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 22e2e81..5606744 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 2ab1696..1be0e46 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/reconnect.c b/tests/reconnect.c
index 4c4d648..e9bdcdb 100644
--- a/tests/reconnect.c
+++ b/tests/reconnect.c
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
index 6586e92..c55aa4b 100644
--- a/tests/sexpr2xmltest.c
+++ b/tests/sexpr2xmltest.c
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <string.h>
diff --git a/tests/testutils.c b/tests/testutils.c
index 4fea6b6..80b1022 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -10,7 +10,7 @@
* $Id$
*/
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/virshtest.c b/tests/virshtest.c
index fd6dcbb..676cb71 100644
--- a/tests/virshtest.c
+++ b/tests/virshtest.c
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <string.h>
diff --git a/tests/xencapstest.c b/tests/xencapstest.c
index bf9ce07..1307d80 100644
--- a/tests/xencapstest.c
+++ b/tests/xencapstest.c
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index 51f4b67..424eae4 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -21,7 +21,7 @@
*
*/
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <string.h>
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
index 2d18e60..3118379 100644
--- a/tests/xml2sexprtest.c
+++ b/tests/xml2sexprtest.c
@@ -1,5 +1,5 @@
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/xmlrpctest.c b/tests/xmlrpctest.c
index 5fa937f..eb75f64 100644
--- a/tests/xmlrpctest.c
+++ b/tests/xmlrpctest.c
@@ -10,7 +10,7 @@
* $Id$
*/
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
--
1.5.4.rc4.15.g215c5
3
3
This ensures that files with translatable strings
are listed in po/POTFILES.in.
Currently it checks only the "error" function.
Obviously we'll have to add a few more here, but I'll
do that separately.
----------------
Enable the po-check test; fix violations.
* Makefile.cfg (local-checks-to-skip) [po-check]: Enable.
* po/POTFILES.in: Add three file names. Sort.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
Makefile.cfg | 1 -
po/POTFILES.in | 21 ++++++++++++---------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/Makefile.cfg b/Makefile.cfg
index 2c1c9e7..697fde4 100644
--- a/Makefile.cfg
+++ b/Makefile.cfg
@@ -26,7 +26,6 @@ url_dir_list = \
# Tests not to run as part of "make distcheck".
local-checks-to-skip = \
- po-check \
makefile_path_separator_check \
makefile-check \
sc_no_have_config_h \
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 50422fb..b4b9cd2 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,13 +1,16 @@
-src/libvirt.c
-src/virterror.c
-src/xmlrpc.c
+gnulib/lib/gai_strerror.c
+src/conf.c
+src/console.c
src/hash.c
-src/test.c
-src/xml.c
+src/libvirt.c
+src/proxy_internal.c
+src/remote_internal.c
src/sexpr.c
-src/xend_internal.c
+src/test.c
src/virsh.c
-src/conf.c
-src/xs_internal.c
-src/proxy_internal.c
+src/virterror.c
src/xen_internal.c
+src/xend_internal.c
+src/xml.c
+src/xmlrpc.c
+src/xs_internal.c
--
1.5.4.rc4.15.g215c5
3
2