From d27098c0549f856cc44ea20ce2c31d6b89a28946 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Fri, 23 Oct 2009 12:13:20 +0200 Subject: [PATCH] Add a new syntax-check rule for gethostname. We should always be using virGetHostname in place of gethostname; thus add in a new syntax-check rule to make sure no new uses creep in. Signed-off-by: Chris Lalancette --- .x-sc_prohibit_gethostname | 2 ++ Makefile.am | 1 + cfg.mk | 5 +++++ src/libvirt.c | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .x-sc_prohibit_gethostname diff --git a/.x-sc_prohibit_gethostname b/.x-sc_prohibit_gethostname new file mode 100644 index 0000000000..e7acb03379 --- /dev/null +++ b/.x-sc_prohibit_gethostname @@ -0,0 +1,2 @@ +^src/util/util\.c$ +^ChangeLog-old$ diff --git a/Makefile.am b/Makefile.am index 14fc593c8d..32cd96a0f8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,6 +23,7 @@ EXTRA_DIST = \ .x-sc_m4_quote_check \ .x-sc_prohibit_asprintf \ .x-sc_prohibit_gethostby \ + .x-sc_prohibit_gethostname \ .x-sc_prohibit_have_config_h \ .x-sc_prohibit_HAVE_MBRTOWC \ .x-sc_prohibit_nonreentrant \ diff --git a/cfg.mk b/cfg.mk index c1d3864fba..45d6531c94 100644 --- a/cfg.mk +++ b/cfg.mk @@ -94,6 +94,11 @@ sc_prohibit_strncpy: msg='use virStrncpy, not strncpy' \ $(_prohibit_regexp) +sc_prohibit_gethostname: + @re='gethostname *\(' \ + msg='use virGetHostname, not gethostname' \ + $(_prohibit_regexp) + sc_prohibit_VIR_ERR_NO_MEMORY: @re='\' \ msg='use virReportOOMError, not V'IR_ERR_NO_MEMORY \ diff --git a/src/libvirt.c b/src/libvirt.c index 9e8790023a..5fe1506b93 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -1441,7 +1441,7 @@ error: * @conn: pointer to a hypervisor connection * * This returns the system hostname on which the hypervisor is - * running (the result of the gethostname(2) system call). If + * running (the result of the gethostname system call). If * we are connected to a remote system, then this returns the * hostname of the remote system. * -- 2.47.2