On Wed, Nov 13, 2019 at 10:44:18AM -0600, Eric Blake wrote:
On 11/13/19 10:33 AM, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
> ---
>
> new in v2
>
> build-aux/syntax-check.mk | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
> index ff1198ca73..78458dce53 100644
> --- a/build-aux/syntax-check.mk
> +++ b/build-aux/syntax-check.mk
> @@ -469,6 +469,11 @@ sc_prohibit_sprintf:
> halt='use g_snprintf, not sprintf' \
> $(_sc_search_regexp)
> +sc_prohibit_snprintf:
> + @prohibit='\<snprintf\>' \
> + halt='use g_snprintf, not snprintf' \
> + $(_sc_search_regexp)
> +
Ah, you added a second rule instead of merging the two checks into one rule.
> sc_prohibit_readlink:
> @prohibit='\<readlink *\(' \
> halt='use virFileResolveLink, not readlink' \
> @@ -2264,6 +2269,9 @@ exclude_file_name_regexp--sc_prohibit_setuid =
^src/util/virutil\.c|tools/virt-l
> exclude_file_name_regexp--sc_prohibit_sprintf = \
> ^(build-aux/syntax-check\.mk|docs/hacking\.html\.in|.*\.stp|.*\.pl)$$
> +exclude_file_name_regexp--sc_prohibit_snprintf = \
> + ^(build-aux/syntax-check\.mk|docs/hacking\.html\.in|tools/virt-login-shell\.c)$$
> +
Still, if we are using g_snprintf for both, a single merged rule might be
easier to use.
I was considering to merge both rules, the only reason to do it this way
was that we should probably forbid sprintf and printf in
virt-login-shell.c as well. But I'm OK with merging it together.
Pavel