[sheepdog] [PATCH v2 4/5] checkpatch: add check for strerror(errno)

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Feb 25 16:11:13 CET 2013


For simplicity, let's use %m instead.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 script/checkpatch.pl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/script/checkpatch.pl b/script/checkpatch.pl
index 3ce0db8..f2b74da 100755
--- a/script/checkpatch.pl
+++ b/script/checkpatch.pl
@@ -2889,6 +2889,11 @@ sub process {
 		    WARN("NEWLINE_IN_SDPRINTF",
 			 "'\\n' is not required for $1 format string\n" . $herecurr);
 		}
+# check for strerror(errno)
+		if ($line =~ /\bstrerror\(errno\)/) {
+		    WARN("STRERROR",
+			 "use %m instead of strerror(errno)\n" . $herecurr);
+		}
 	}
 
 	# If we have no input at all, then there is nothing to report on
-- 
1.8.1.3.566.gaa39828




More information about the sheepdog mailing list