]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: prohibit use of strncpy
authorJim Meyering <meyering@redhat.com>
Thu, 24 May 2012 14:21:34 +0000 (16:21 +0200)
committerJim Meyering <meyering@redhat.com>
Sun, 10 Jun 2012 20:02:26 +0000 (22:02 +0200)
* cfg.mk (sc_prohibit_strncpy): New syntax-check rule.
Exempt pinky.c and who.c, at least for now.

cfg.mk

diff --git a/cfg.mk b/cfg.mk
index 040d7e17f123e4248ccf0ae1bca8699bffac73ee..c94109ca37c8f34189432bee01f1f9c8bc86217b 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -403,6 +403,12 @@ sc_prohibit_strncmp:
          { echo '$(ME): use STREQ_LEN or STRPREFIX instead of str''ncmp' \
                1>&2; exit 1; } || :
 
+# Really.  You don't want to use this function.
+sc_prohibit_strncpy:
+       @prohibit='\<str''ncpy *\('                                     \
+       halt='do not use str''ncpy, period'                             \
+         $(_sc_search_regexp)
+
 # Enforce recommended preprocessor indentation style.
 sc_preprocessor_indentation:
        @if cppi --version >/dev/null 2>&1; then                        \
@@ -485,3 +491,6 @@ exclude_file_name_regexp--sc_prohibit_test_backticks = \
 # Exempt test.c, since it's nominally shared, and relatively static.
 exclude_file_name_regexp--sc_prohibit_operator_at_end_of_line = \
   ^src/(ptx|test|head)\.c$$
+
+# Exempt pinky and who: their uses of this function appear to be correct.
+exclude_file_name_regexp--sc_prohibit_strncpy = ^src/(pinky|who)\.c$$