checkpatch: update octal permissions warning

When checking permissions, make sure 4 octal digits are used, but allow
a single 0 too.

Signed-off-by: Joe Perches <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Joe Perches authored and Linus Torvalds committed 2014-04-03 16:21:13 -07:00
1 parent fbdb8138cf
commit 1727cc7045
1 file changed
+4 -2
+4 -2
View File
@@ -4512,9 +4512,11 @@ sub process {
my $val = $1;
$val = $6 if ($skip_args ne "");
if ($val =~ /^$Int$/ && $val !~ /^$Octal$/) {
if ($val !~ /^0$/ &&
(($val =~ /^$Int$/ && $val !~ /^$Octal$/) ||
length($val) ne 4)) {
ERROR("NON_OCTAL_PERMISSIONS",
"Use octal not decimal permissions\n" . $herecurr);
"Use 4 digit octal (0777) not decimal permissions\n" . $herecurr);
}
}
}