diff top/maint.mk @ 16880:cb54ca844f1c

maint.mk: add strncpy-prohibiting syntax-check rule * top/maint.mk (sc_prohibit_strncpy): New rule, from coreutils.
author Jim Meyering <meyering@redhat.com>
date Fri, 25 May 2012 16:38:49 +0200
parents 0036a8da5e45
children e52a7cef746b
line wrap: on
line diff
--- a/top/maint.mk	Fri May 25 09:18:18 2012 -0700
+++ b/top/maint.mk	Fri May 25 16:38:49 2012 +0200
@@ -332,6 +332,14 @@
 	halt='$(ME): replace strcmp calls above with STREQ/STRNEQ'	\
 	  $(_sc_search_regexp)
 
+# Really.  You don't want to use this function.
+# It may fail to NUL-terminate the destination,
+# and always NUL-pads out to the specified length.
+sc_prohibit_strncpy:
+	@prohibit='\<strncpy *\('					\
+	halt='do not use strncpy, period'				\
+	  $(_sc_search_regexp)
+
 # Pass EXIT_*, not number, to usage, exit, and error (when exiting)
 # Convert all uses automatically, via these two commands:
 # git grep -l '\<exit *(1)' \