[libvirt] [PATCH 2/2] maint: reject raw close, popen in 'make syntax-check'

Matthias Bolte matthias.bolte at googlemail.com
Fri Jan 28 23:04:48 UTC 2011


2011/1/28 Eric Blake <eblake at redhat.com>:
> commit f1fe9671e was supposed to make sure we use files.h
> macros to avoid double close, but it didn't work.
>
> Meanwhile, virCommand is vastly superior to system(), fork(),
> and popen() (also to virExec, but we haven't completed that
> conversion), so enforce that, too.
>
> * cfg.mk (sc_prohibit_close): Fix typo that excluded close, and
> add pclose.
> (sc_prohibit_fork_wrappers): New rule, for fork, system, and popen.
> * .x-sc_prohibit_close: More exemptions.
> * .x-sc_prohibit_fork_wrappers: New file.
> * Makefile.am (syntax_check_exceptions): Ship new file.
> * src/datatypes.c (virReleaseConnect): Tweak comment to avoid
> false positive.
> * src/util/files.h (VIR_CLOSE): Likewise.
> ---
>  .x-sc_prohibit_close         |    6 ++++++
>  .x-sc_prohibit_fork_wrappers |    8 ++++++++
>  Makefile.am                  |    1 +
>  cfg.mk                       |    9 ++++++++-
>  src/datatypes.c              |    2 +-
>  src/util/files.h             |    4 ++--
>  6 files changed, 26 insertions(+), 4 deletions(-)
>  create mode 100644 .x-sc_prohibit_fork_wrappers
>
> diff --git a/.x-sc_prohibit_close b/.x-sc_prohibit_close
> index 348200c..0b47b29 100644
> --- a/.x-sc_prohibit_close
> +++ b/.x-sc_prohibit_close
> @@ -1,3 +1,9 @@
> +# Non-C files:
>  ^docs/.*
> +^ChangeLog*
>  ^HACKING$
> +*.py$

Shouldn't the dot be escaped here like in the other lines you added?

> +# Wrapper implementation:
>  ^src/util/files.c$

And here too, although this one is pre-existing.

> +# Only uses close in documentation comments:
> +^src/libvirt\.c$

ACK, with that nit fixed.

Matthias




More information about the libvir-list mailing list