[libvirt] [PATCH v2 6/8] syntax-check: Prohibit canonicalize_file_name()

Andrea Bolognani abologna at redhat.com
Mon Apr 30 16:53:01 UTC 2018


Now what we have removed all uses of the function, we want to
prevent it from creeping back in.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 cfg.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/cfg.mk b/cfg.mk
index c3d18279ce..7ffa10f563 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -462,6 +462,13 @@ sc_prohibit_ctype_h:
 	halt='use c-ctype.h instead of ctype.h' \
 	  $(_sc_search_regexp)
 
+# canonicalize_file_name() is only available in glibc, and the gnulib
+# version is difficult to mock; realpath() suffers from neither limitation
+sc_prohibit_canonicalize_file_name:
+	@prohibit='\<canonicalize_file_name\(' \
+	halt='use realpath(path, NULL) instead of canonicalize_file_name(path)' \
+	  $(_sc_search_regexp)
+
 # Insist on correct types for [pug]id.
 sc_correct_id_types:
 	@prohibit='\<(int|long) *[pug]id\>' \
@@ -1208,6 +1215,9 @@ exclude_file_name_regexp--sc_prohibit_nonreentrant = \
 exclude_file_name_regexp--sc_prohibit_select = \
 	^cfg\.mk$$
 
+exclude_file_name_regexp--sc_prohibit_canonicalize_file_name = \
+  ^cfg\.mk$$
+
 exclude_file_name_regexp--sc_prohibit_raw_allocation = \
   ^(docs/hacking\.html\.in|src/util/viralloc\.[ch]|examples/.*|tests/(securityselinuxhelper|(vircgroup|nss)mock|commandhelper)\.c|tools/wireshark/src/packet-libvirt\.c)$$
 
-- 
2.14.3




More information about the libvir-list mailing list