From: Jim Meyering <meyering@redhat.com>
Date: Fri, 25 May 2012 14:38:49 +0000 (+0200)
Subject: maint.mk: add strncpy-prohibiting syntax-check rule
X-Git-Tag: v0.1~646
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=52236aad8177d4ae1df7b0c31633661775b759bb;p=gnulib.git

maint.mk: add strncpy-prohibiting syntax-check rule

* top/maint.mk (sc_prohibit_strncpy): New rule, from coreutils.
---

diff --git a/ChangeLog b/ChangeLog
index 686228ca07..125210066a 100644
--- 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
diff --git a/top/maint.mk b/top/maint.mk
index 9746410771..11cb6a6264 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -332,6 +332,14 @@ sc_prohibit_strcmp:
 	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)' \