changeset 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 29f5ac75cf9e
children 122207a2ef3a
files ChangeLog top/maint.mk
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-25  Jim Meyering  <meyering@redhat.com>
+
+	maint.mk: add strncpy-prohibiting syntax-check rule
+	* top/maint.mk (sc_prohibit_strncpy): New rule, from coreutils.
+
 2012-05-24  Jim Meyering  <meyering@redhat.com>
 
 	maint.mk: compute $(gpg_key_ID) more portably
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -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)' \