]> Savannah Git Hosting - gnulib.git/commitdiff
maint.mk: add strncpy-prohibiting syntax-check rule
authorJim Meyering <meyering@redhat.com>
Fri, 25 May 2012 14:38:49 +0000 (16:38 +0200)
committerJim Meyering <meyering@redhat.com>
Fri, 25 May 2012 17:19:18 +0000 (19:19 +0200)
* top/maint.mk (sc_prohibit_strncpy): New rule, from coreutils.

ChangeLog
top/maint.mk

index 686228ca075ce15ed8a0e273051ebaebe514a37b..125210066ad9822cd41873e61ec44d474d6637d4 100644 (file)
--- 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
index 97464107718e60a4fa0fe559f8e09dac36585626..11cb6a6264f9ec4f30110138920ee75602e2d663 100644 (file)
@@ -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)' \